Hello guys.
This is my first community post, so feel free to tell me if anything is wrong with my post.
Now the real talk. I am trying to implement BLE on my ESP32-S3 dev board using Arduino IDE. I tried to make the simplest possible program, just to be able to connect to my board via nRFConnect app.
Here's what I made :
#include <BLEDevice.h>
#include <BLEServer.h>
bool deviceConnected = false;
class MyServerCallbacks : public BLEServerCallbacks{
void onConnect(BLEServer *MyServer){
deviceConnected = true;
Serial.println("BLE connected!");
}
void onDisconnect(BLEServer *MyServer){
deviceConnected = false;
Serial.println("Ble disconnected.");
}
};
void setup(){
Serial.begin(115200);
Serial.println("Starting BLE");
//Create BLE device
BLEDevice::init("ESP32BLE");
Serial.println("BLEDevice init");
//Create BLE server
BLEServer *MyServer = BLEDevice::createServer();
MyServer->setCallbacks(new MyServerCallbacks());
Serial.println("BLEServer init");
//Start advertising
MyServer->getAdvertising()->start();
Serial.println("Server start");
}
void loop(){
}
This code was copied from a french tutorial available here:
When reading my Serial Monitor, "Starting BLE" is displayed, then the program waits for about 10 seconds and Task Watchdog is triggered, reseting the app.
I am NOT able to detect my device on the app even though it should be capable of doing so. Any idea how to solve this problem?
Sorry if that sounds trivial to some of you, but hope to get some helpfull tips.
Thanks