Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from network import Bluetooth
- bluetooth = Bluetooth()
- bluetooth.set_advertisement(name='LoPy', service_uuid=b'1234567890123456')
- def conn_cb (bt_o):
- events = bt_o.events() # this method returns the flags and clears the internal registry
- if events & Bluetooth.CLIENT_CONNECTED:
- print("Client connected")
- elif events & Bluetooth.CLIENT_DISCONNECTED:
- print("Client disconnected")
- bluetooth.callback(trigger=Bluetooth.CLIENT_CONNECTED | Bluetooth.CLIENT_DISCONNECTED, handler=conn_cb)
- bluetooth.advertise(True)
Add Comment
Please, Sign In to add comment