I have the following setup for controlling a robot:
- Remote control (xBee3 ZigBee [firmware 100A] + Arduino)
- Robot main part (xBee3 ZigBee [firmware 100A] + Arduino)
- Robot rotating part (BLE device / Adafruit feather) which exchanges data only with the main part (which forwards some values to the remote control)
In order to send data via BLE I have set up MicroPython in the xBee and the connection works well.
As the AP mode has to be set to 4 (MicroPython REPL) for Micropython to see the traffic, the connected Arduino does not receive the data from the remote control unless I forward it via sys.stdout.write inside the permanent loop.
Sometimes this leads to lags in the transmission (as analog signals for 2 joysticks have to be sent) and in case the BLE connection is closed, the reconnect blocks everything for at least 500ms. This floods the Arduino with all commands in the buffer afterwards.
Is there some way to avoid this (i.e. use AP 0 mode and MicroPython only "listens" to the traffic and can add packets if necessary)?
Or can there at least be a "parallel" process be called for the ble.gap_connect routine so it does not block the code?
Any hint/source/example is appreciated (also a "cannot work" as it could save me lots of time)