I've installed micro python firmware v4.1.2 on an arduino nano 33 ble with OpenMV ide. The ide comes with a python script example: ble_blinky_1.py.
The script is also available here: https://docs.arduino.cc/tutorials/nano-33-ble/ble-python-api
For an unknown reason, the connection with a smartphone does not work and the connection event handler will not be triggered.
Here is an excerpt of the file:
def event_handler(id, handle, data):
global periph
global service
if id == constants.EVT_GAP_CONNECTED:
pass
elif id == constants.EVT_GAP_DISCONNECTED:
# restart advertisement
periph.advertise(device_name="Nano 33 BLE", services=[service])
elif id == constants.EVT_GATTS_WRITE:
LED(1).on() if int(data[0]) else LED(1).off()
periph = Peripheral()
periph.setConnectionHandler(event_handler)
Does anyone know why?