1

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?

Dominik
  • 101
  • 12
  • 2
    do you get any error message when you run it in console/terminal? always put full error message (starting at word "Traceback") in question (not in comments) as text (not screenshot, not link to external portal). There are other useful information. – furas Nov 18 '21 at 20:42
  • no, there aren't any error messages – Dominik Nov 18 '21 at 20:56
  • 1
    so you can use `print()` to see which part of code is executed and what you have in variables. It is called `"print debuging"`. It can help to see what can make problem. You could also use other tools/programs to connect with device - maybe there is other problem and other tools may detect it. – furas Nov 18 '21 at 22:04
  • Your arduino is your peripheral and you try to connect to it using your smartphone. Which app do you use to establish the connection? – Michael Kotzjan Nov 19 '21 at 12:02

0 Answers0