1

我已经在带有 OpenMV ide 的 arduino nano 33 ble 上安装了 micro python 固件 v4.1.2。ide 附带一个 python 脚本示例:ble_blinky_1.py。

该脚本也可在此处获得:https ://docs.arduino.cc/tutorials/nano-33-ble/ble-python-api

由于未知原因,与智能手机的连接不起作用,并且不会触发连接事件处理程序。

这是该文件的摘录

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)

有谁知道为什么?

4

0 回答 0