Closed abhishek-v-pandey closed 3 years ago
This is not a fault with btcomm.
You are creating a BluetoothClient (and therefore connection) each time around your loop. The error is telling you the resource is already in use.
You only need to create the client once.
Move this outside your while loop:
r = BluetoothClient("DC:A6:32:4C:9D:ED
I would encourage you to use the raspberrypi forum when asking for help. I am often the only person who monitors these issues.
Hi, I need to send a pressure sensor data collected from an Arduino from one Raspberry Pi 4 to another Raspberry Pi 4. I used bluedot btcomm client server architecture. The connection is established but the client disconnects after sending two readings.
Raspberry Pi 4 client code:
Raspberry Pi server code
The error that i am facing.
`pi@raspberrypi:~/Desktop/rpible $ sudo python3 onearduino_senddata.py Connecting.. Discovering Services.. Discovering characteristics..
temperature 3 : 18 C Barometric pressure 3 : 100 kPa
temperature 3 : 19 C Barometric pressure 3 : 100 kPa Traceback (most recent call last): File "onearduino_senddata.py", line 83, in
main()
File "onearduino_senddata.py", line 80, in main
loop()
File "onearduino_senddata.py", line 70, in loop
r = BluetoothClient("DC:A6:32:4C:9D:ED", data_received_callback=None, port=2)
File "/usr/local/lib/python3.7/dist-packages/bluedot/btcomm.py", line 567, in init
self.connect()
File "/usr/local/lib/python3.7/dist-packages/bluedot/btcomm.py", line 660, in connect
self._client_sock.connect((server_mac, self._port))
OSError: [Errno 16] Device or resource busy
`
please help me to solve since its showing related to bluedot. If not related to bluedot , m sorry , but please how to resolve it.
Thanks
Edited to format code correctly