sanderzw
Hi everyone,
I'm working on a project with a Raspberry Pi where I'm using Python to connect to cycling speed and cadence sensors via Bluetooth. The program uses asyncio and bleak for handling the Bluetooth connections. My script successfully connects to the sensors and reads data on the first attempt, but I encounter connection problems on subsequent tries.
Here's a brief overview of what my code does:
Connects to two cycling sensors using their Bluetooth addresses.
Reads cycling speed and cadence data for 30 seconds.
Disconnects from the sensors.
On the first run, everything works as expected. However, when I try to run the program again, it fails to connect to the sensors. The error I receive is not very detailed, making it hard to diagnose the problem.
I suspect the issue might be related to how the Bluetooth connection is being handled, or perhaps the sensors are not properly resetting after the first connection. I'm not sure if it's a problem with the Raspberry Pi's Bluetooth interface, an issue with the bleak library, or something else.
Has anyone experienced similar issues or have any insights into what might be going wrong? Any help or suggestions would be greatly appreciated!