Detecting and recovering from “hanging” bluetooth python connection
问题 I have a bluetooth connection between a Raspberry Pi 3b+ and an Arduino Mega, using the RPi built-in module, and an HC-05 module on the Arduino. Bi-directional communication works like a charm, for minutes to sometimes, hours at a time. Then, at seemingly random times, the python code hangs, blocked on the sock.recv() function. I can kill it via ctrl-c, and restart it, and it usually reconnects without a problem. I know Bluetooth is a little finicky and so while any suggestions of how to make