Arduino ESP32 BLE Examples

roundporch
Posts: 2
Joined: Sun Dec 02, 2018 1:10 am

Arduino ESP32 BLE Examples

Postby roundporch » Sun Dec 02, 2018 1:21 am

Hello, I'm trying to get the client / server examples working. Found it odd the service and char UUID don't match in the example. But that's no big deal right? I changed the client so it matches the server example and also tried changing the client so it matches the server but client will not connect.

It sees the advertised device

Code: Select all

 BLE Advertised Device found: Name: MyESP32, Address: 24:0a:c4:96:70:7a, txPower: -21
But it's never getting to this condition even though I've made the uuids the same.

Code: Select all

 if (advertisedDevice.haveServiceUUID() && advertisedDevice.getServiceUUID().equals(serviceUUID)) {
The only thing I modified in the BLE_client and BLE_server sketchers is the uuid for service and char to match them up

Code: Select all

// Client
// The remote service we wish to connect to.
static BLEUUID serviceUUID("4fafc201-1fb5-459e-8fcc-c5c9c331914b");
// The characteristic of the remote service we are interested in.
static BLEUUID    charUUID("beb5483e-36e1-4688-b7f5-ea07361b26a8");

// Server
#define SERVICE_UUID        "4fafc201-1fb5-459e-8fcc-c5c9c331914b"
#define CHARACTERISTIC_UUID "beb5483e-36e1-4688-b7f5-ea07361b26a8"
Thanks

chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

Re: Arduino ESP32 BLE Examples

Postby chegewara » Sun Dec 02, 2018 8:11 am

Hi, ble examples has been updated recently.
Here you have client example with better version searching by service UUID:
https://github.com/nkolban/ESP32_BLE_Ar ... t.ino#L103

And here is line that was missing in old server example but is requires to use client/server togheter:
https://github.com/nkolban/ESP32_BLE_Ar ... er.ino#L34

roundporch
Posts: 2
Joined: Sun Dec 02, 2018 1:10 am

Re: Arduino ESP32 BLE Examples

Postby roundporch » Mon Dec 03, 2018 3:07 am

Thanks for providing the code. These updated ones work out of the box.

Who is online

Users browsing this forum: jesper and 42 guests