Page 1 of 1

send data thru BLE between 2 esp32

Posted: Sun Apr 03, 2022 7:36 am
by 666hjk
Hi All,

i'm trying to click a button(write) @ server-side, and ON an LED on client-side upon connected.

server-side,
if (deviceConnected) {
if (Button == 0) { // button pressed
pCharacteristic->setValue("ON");
pCharacteristic->notify();
}
}

how do i retrieve the sent value? is there any example sketch i can refer to for better understanding.
Thanks.

New bird on flight.

Re: send data thru BLE between 2 esp32

Posted: Sun Apr 03, 2022 4:46 pm
by rpiloverbd
Not exactly what you want to do, but from here you'll get an idea about how to proceed: https://randomnerdtutorials.com/esp-now ... ion-esp32/
After configuring the esp32 boards as master and slave, you have to send an ASCI character from the Master. For example 'H' for turning on the LED and 'L' for turning it off. The job of the MASTER will be to send H and L.
The slave will receive the ASCI character and Turn on/off the LED accordingly.

Re: send data thru BLE between 2 esp32

Posted: Mon Apr 04, 2022 6:42 am
by 666hjk
Thanks.

I was thinking of using BLE, if i should be (button click)sending character from server side then client side to ON LED. or the other way.

I've use handphone app to ON the LED easily but would like to explore on how to use between 2 esp32 and learnt the basic.

Re: send data thru BLE between 2 esp32

Posted: Mon Apr 04, 2022 12:05 pm
by bobolink
This example sends a discrete IO bit over BLE
ESP32-C3, Arduino IDE, nimble BLE stack.
https://github.com/bobh/nimBLE-discrete-xfer

Re: send data thru BLE between 2 esp32

Posted: Tue Apr 05, 2022 9:18 am
by 666hjk
Thanks for the link.

Not use nimBLE library before, would go thru your code to understand and learn something from it.

Saw the youtube too , should be useful for me :D