diff --git a/examples/BLE/BLE_server/BLE_server.ino b/examples/BLE/BLE_server/BLE_server.ino new file mode 100644 index 0000000..bade236 --- /dev/null +++ b/examples/BLE/BLE_server/BLE_server.ino @@ -0,0 +1,48 @@ +/* + Based on Neil Kolban example for IDF: https://github.com/nkolban/esp32-snippets/blob/master/cpp_utils/tests/BLE%20Tests/SampleServer.cpp + Ported to Arduino ESP32 by Evandro Copercini + updates by chegewara +*/ + +// note : Example to test whether the BLE function of the board is normal + +#include +#include +#include +#include + +// See the following for generating UUIDs: +// https://www.uuidgenerator.net/ + +#define SERVICE_UUID "4fafc201-1fb5-459e-8fcc-c5c9c331914b" +#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8" + +void setup() { + Serial.begin(115200); + Serial.println("Starting BLE work!"); + + BLEDevice::init("LilyGo-BLE"); + BLEServer *pServer = BLEDevice::createServer(); + BLEService *pService = pServer->createService(SERVICE_UUID); + BLECharacteristic *pCharacteristic = pService->createCharacteristic( + CHARACTERISTIC_UUID, + BLECharacteristic::PROPERTY_READ | + BLECharacteristic::PROPERTY_WRITE + ); + + pCharacteristic->setValue("Hello World says Neil"); + pService->start(); + // BLEAdvertising *pAdvertising = pServer->getAdvertising(); // this still is working for backward compatibility + BLEAdvertising *pAdvertising = BLEDevice::getAdvertising(); + pAdvertising->addServiceUUID(SERVICE_UUID); + pAdvertising->setScanResponse(true); + pAdvertising->setMinPreferred(0x06); // functions that help with iPhone connections issue + pAdvertising->setMinPreferred(0x12); + BLEDevice::startAdvertising(); + Serial.println("Characteristic defined! Now you can read it in your phone!"); +} + +void loop() { + // put your main code here, to run repeatedly: + delay(2000); +} \ No newline at end of file diff --git a/firmware/BLE/README.MD b/firmware/BLE/README.MD new file mode 100644 index 0000000..e0566fa --- /dev/null +++ b/firmware/BLE/README.MD @@ -0,0 +1,14 @@ + +# BLE Firmware + +## 1. Firmware to test whether the BLE function of the board is normal + +* **esp32_ble_server.bin** For esp32 , Write address 0x0 +* **esp32s3_ble_server.bin** For esp32s3 , Write address 0x0 +* How to write firmware, please see [here](../GPS_Reset/README.MD) + + + + + + diff --git a/firmware/BLE/esp32_ble_server.bin b/firmware/BLE/esp32_ble_server.bin new file mode 100644 index 0000000..42b3141 Binary files /dev/null and b/firmware/BLE/esp32_ble_server.bin differ diff --git a/firmware/BLE/esp32s3_ble_server.bin b/firmware/BLE/esp32s3_ble_server.bin new file mode 100644 index 0000000..034cd7b Binary files /dev/null and b/firmware/BLE/esp32s3_ble_server.bin differ