Problem with sending data trought Blueetooth from Arduino to Raspberry BLE

Hi everyone I was trying to use this post in the forum to send a simple int from my Arduino Nano BLE 33 Sense. So my problem is when I use Thonny to run this code --->

import binascii
import struct
import time
from bluepy.btle import UUID,Peripheral
temp_uuid = UUID("590d0004-3a0a-4023-a05a-6aaf2f22441c")
p = Peripheral("EE:E3:AF:96:96:96","public")
services = p.getServices()

try:
    ch = p.getCharacteristics(uuid=UUID(0x0004))[0]
    while 1:
        val = ch.read()
        print(struct.unpack_from('e',val))
finally:
    p.disconnect()

And when I run it send me this error ---->

Traceback (most recent call last):
  File "/home/pi/Desktop/bluet.py", line 6, in <module>
    p = Peripheral("7C:EO:D5:3E:43:73","public")
  File "/usr/local/lib/python3.9/dist-packages/bluepy/btle.py", line 391, in __init__
    self._connect(deviceAddr, addrType, iface)
  File "/usr/local/lib/python3.9/dist-packages/bluepy/btle.py", line 439, in _connect
    raise BTLEDisconnectError("Failed to connect to peripheral %s, addr type: %s" % (addr, addrType), rsp)
bluepy.btle.BTLEDisconnectError: Failed to connect to peripheral 7C:EO:D5:3E:43:73, addr type: public

Someone could help me to fix this problem, please or give me a recomendation to receive Data trought Bluetooth in Windows or Raspberry with Thonny.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.