Skip to content
This repository was archived by the owner on Sep 16, 2024. It is now read-only.
This repository was archived by the owner on Sep 16, 2024. It is now read-only.

BLE - OSError: connection refused #15

Closed
@Bucknalla

Description

@Bucknalla
(sysname='LoPy', nodename='LoPy', release='1.6.13.b1', version='v1.8.6-607-g9c8a0e9e on 2017-05-01', machine='LoPy with 
ESP32', lorawan='1.0.0') 

Attempting to connect from one LoPy to another LoPy device:

from network import Bluetooth
import binascii
bluetooth = Bluetooth()

# scan until we can connect to any BLE device around
bluetooth.start_scan(-1)
adv = None
while True:
    adv = bluetooth.get_adv()
    if adv:
        try:
            print(binascii.hexlify(adv.mac))
            bluetooth.connect(adv.mac)
        except:
            # start scanning again
            bluetooth.start_scan(-1)
            continue
        break
print("Connected to device with addr = {}".format(binascii.hexlify(adv.mac)))

Error arises after the connecting LoPy finds the address of the advertising device and attempts to connect.

b'240ac40061fa'
Traceback (most recent call last):                                                                                      
  File "<stdin>", line 50, in <module>                                                                                  
OSError: connection already closed

                                                                         
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions