LoPy to LoPY BLE example problems
-
Hi!
I'm fairly new to working with BLE but have been trying to follow and use the examples given to understand how to get it working. As I understand it, the LoPy (or other Pycom moduels supporting BLE) can act as both a client and a server.
And by following/copying the BLE callback example with one LoPy as the Client and another LoPy as the Server they should be able to exchange information.By just copy pasting the code and flashing it on to the LoPy's I get them to connect but when the client tries to find the characteristic within the services it can never find the correct uuid (one equal to 0xec0e) for the charactersistic. Part of code I'm talking about:
#more code below this see link to example for service in services: chars = service.characteristics() for char in chars: c_uuid = char.uuid() if c_uuid == 0xec0e: if (char.properties() & Bluetooth.PROP_NOTIFY): char.callback(trigger=Bluetooth.CHAR_NOTIFY_EVENT, handler=char_notify_callback) print(c_uuid) break #more code below this see link to example
When actually printing the c_uuid it always gives me the integers:
- 10757
- 10752
- 10753
- 10918
None of these equal to the value of 60430 (0xec0e) and the if statement will never become true. So how should I compare the values or convert the values for them to be comparable?
Is there some conversion missing in the example or have I just missunderstood the examples?
Thanks in advannce //Alex