send data thru BLE between 2 esp32

User avatar
666hjk
Posts: 47
Joined: Wed Jan 12, 2022 3:09 am
Location: 小红点

send data thru BLE between 2 esp32

Postby 666hjk » Sun Apr 03, 2022 7:36 am

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.
学习中找战友。

rpiloverbd
Posts: 101
Joined: Tue Mar 22, 2022 5:23 am

Re: send data thru BLE between 2 esp32

Postby rpiloverbd » Sun Apr 03, 2022 4:46 pm

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.

User avatar
666hjk
Posts: 47
Joined: Wed Jan 12, 2022 3:09 am
Location: 小红点

Re: send data thru BLE between 2 esp32

Postby 666hjk » Mon Apr 04, 2022 6:42 am

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.
学习中找战友。

bobolink
Posts: 98
Joined: Mon Feb 26, 2018 4:17 pm

Re: send data thru BLE between 2 esp32

Postby bobolink » Mon Apr 04, 2022 12:05 pm

This example sends a discrete IO bit over BLE
ESP32-C3, Arduino IDE, nimble BLE stack.
https://github.com/bobh/nimBLE-discrete-xfer

User avatar
666hjk
Posts: 47
Joined: Wed Jan 12, 2022 3:09 am
Location: 小红点

Re: send data thru BLE between 2 esp32

Postby 666hjk » Tue Apr 05, 2022 9:18 am

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
学习中找战友。

Who is online

Users browsing this forum: Google [Bot], jgustavoam and 39 guests