-
Notifications
You must be signed in to change notification settings - Fork 189
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <Arduino.h> | ||
#include <BLEDevice.h> | ||
#include <BLEUtils.h> | ||
#include <BLEServer.h> | ||
|
||
// 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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
|
||
|
||
|
||
|
||
|
||
|
Binary file not shown.
Binary file not shown.