Доброго времени суток. Имеется на руках esp32-c3 super mini. Она рабочая, блин стартует на ней. Но вот решил я отправлять со смартфона числа 1 байт, т.е. диапозон от 0 до 255, со смартфона именно BLE терминал, так не могу код написать, уже сил нет, 100500 вариаций делал, форумов облазил, выскакивает это:
\Arduino\libraries\ESP32_BLE_Arduino\src/FreeRTOS.h:61:28: error: 'ringbuf_type_t' has not been declared
Ringbuffer(size_t length, ringbuf_type_t type = RINGBUF_TYPE_NOSPLIT);
именно проблема с ringbuf_type_t.
Может кто сталкивался с данной платой и подобнйо задачей?
\Arduino\libraries\ESP32_BLE_Arduino\src/FreeRTOS.h:61:28: error: 'ringbuf_type_t' has not been declared
Ringbuffer(size_t length, ringbuf_type_t type = RINGBUF_TYPE_NOSPLIT);
именно проблема с ringbuf_type_t.
Может кто сталкивался с данной платой и подобнйо задачей?
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>
BLEServer *pServer = NULL;
BLECharacteristic *pCharacteristic = NULL;
bool deviceConnected = false;
bool oldDeviceConnected = false;
uint8_t receivedValue = 0;
#define SERVICE_UUID "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"
class MyServerCallbacks: public BLEServerCallbacks {
void onConnect(BLEServer* pServer) {
deviceConnected = true;
};
void onDisconnect(BLEServer* pServer) {
deviceConnected = false;
}
};
class MyCharacteristicCallbacks: public BLECharacteristicCallbacks {
void onWrite(BLECharacteristic *pCharacteristic) {
uint8_t *value = pCharacteristic->getData();
if (value) {
receivedValue = *value;
Serial.print("Received value: ");
Serial.println(receivedValue);
}
}
};
void setup() {
Serial.begin(115200);
BLEDevice::init("ESP32 BLE Server");
pServer = BLEDevice::createServer();
pServer->setCallbacks(new MyServerCallbacks());
BLEService *pService = pServer->createService(SERVICE_UUID);
pCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_UUID,
BLECharacteristic:ROPERTY_READ | /BLECharacteristic::№PROPERTY_READ | -убрать №, иначе смайл/
BLECharacteristic:ROPERTY_WRITE /BLECharacteristic::№PROPERTY_WRITE -убрать №, иначе смайл/
);
pCharacteristic->setCallbacks(new MyCharacteristicCallbacks());
pCharacteristic->addDescriptor(new BLE2902());
pService->start();
BLEAdvertising *pAdvertising = pServer->getAdvertising();
pAdvertising->start();
}
void loop() {
if (deviceConnected) {
}
delay(10);
}
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>
BLEServer *pServer = NULL;
BLECharacteristic *pCharacteristic = NULL;
bool deviceConnected = false;
bool oldDeviceConnected = false;
uint8_t receivedValue = 0;
#define SERVICE_UUID "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"
class MyServerCallbacks: public BLEServerCallbacks {
void onConnect(BLEServer* pServer) {
deviceConnected = true;
};
void onDisconnect(BLEServer* pServer) {
deviceConnected = false;
}
};
class MyCharacteristicCallbacks: public BLECharacteristicCallbacks {
void onWrite(BLECharacteristic *pCharacteristic) {
uint8_t *value = pCharacteristic->getData();
if (value) {
receivedValue = *value;
Serial.print("Received value: ");
Serial.println(receivedValue);
}
}
};
void setup() {
Serial.begin(115200);
BLEDevice::init("ESP32 BLE Server");
pServer = BLEDevice::createServer();
pServer->setCallbacks(new MyServerCallbacks());
BLEService *pService = pServer->createService(SERVICE_UUID);
pCharacteristic = pService->createCharacteristic(
CHARACTERISTIC_UUID,
BLECharacteristic:ROPERTY_READ | /BLECharacteristic::№PROPERTY_READ | -убрать №, иначе смайл/
BLECharacteristic:ROPERTY_WRITE /BLECharacteristic::№PROPERTY_WRITE -убрать №, иначе смайл/
);
pCharacteristic->setCallbacks(new MyCharacteristicCallbacks());
pCharacteristic->addDescriptor(new BLE2902());
pService->start();
BLEAdvertising *pAdvertising = pServer->getAdvertising();
pAdvertising->start();
}
void loop() {
if (deviceConnected) {
}
delay(10);
}
Вложения
-
53.8 KB Просмотры: 50