Closed WayneKeenan closed 3 years ago
Thanks @WayneKeenan .
Always interesting to see how other libraries do things. I took a couple of minutes to implement what I thought was the same functionality in BLE_GATT:
import BLE_GATT
LED_STATE = 'E95D7B77-251D-470A-A062-FA1922DFA9A8'
device = BLE_GATT.Central('E9:06:4D:45:FC:8D')
device.connect()
for uuid in device.chrcs:
print(f'Found service {uuid}')
device.char_write(LED_STATE, [65, 66, 67, 68, 69])
device.disconnect()
The main difference to my eye is that the Ruby implementation has an adapter and a service UUID. While that is the "right" thing to do I've not exposed those items by default as in the majority of cases these ended up being boiler plate code.
I like the goal of this project, light on its toes.
I was playing with SonicPi (which is Ruby based) and just from a single
gem install
command I could talk to a Micro:bit from within SonicPi.I don't think I even had to enable bluetoothd --experimental, would need to double check, although, notifications aren't working, but I digress...
How to set some micro:bit LEDs in Ruby: