2black0 / MicroPython-ESP32-BLE

MicroPython ESP32 BLE
MIT License
70 stars 6 forks source link

Sample code for sending data... #1

Open ctschach opened 3 years ago

ctschach commented 3 years ago

Hi, thanks so much for your example code. There aren't a lot of resources outside that cover BLE connections in MicroPython.

Would you be able to create the counterpart for that sample code?

Let's assume we have a second ESP32 that connects to the first one (running your code), requests the temperature and display it on a screen or just console. So connect to a "BLE server", send a request for the temperature and display the data returned from the "BLE server".

Thanks....Carsten

2black0 commented 3 years ago

Hi Carsten,

I am sorry for slow response thanks for your appreciation, its make me happy :)

I think it can be implemented in MicroPython but for quick testing maybe you can test with this code with Arduino code https://github.com/0015/ThatProject/blob/master/Esp32_BLE_to_BLE/ESP32_ble_server/ESP32_ble_server.ino

ctschach commented 3 years ago

Thanks....well, I was hoping for a MicroPython solution. I want to let two ESP32 talk to each other via Bluetooth and currently looking for a solutions. You example was a good start, however, I'm still struggling to get the sending part implemented...

QGB commented 1 year ago

@ctschach @2black0 how to solve,I can’t send data,recv OK

ble.gatts_notify(0, self.tx, b'test')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: -128