Closed
Description
While using this test program from #9440, ctrl-C'ing the program and then typing ctrl-D causes a disconnect/reconnect on USB serial. Commenting out the ble.start_advertising()
prevents the problem. If you comment out the code in while ble.connected:
, the problem remains.
from adafruit_ble import BLERadio
from adafruit_ble.advertising.standard import ProvideServicesAdvertisement
from adafruit_ble.services.nordic import UARTService
import time
time.sleep(2)
print("---Peripheral---")
ble = BLERadio()
uart = UARTService()
advertisement = ProvideServicesAdvertisement(uart)
#time.sleep(1)
while True:
print("Advertising...")
ble.start_advertising(advertisement) # <--- commenting this out causes the problem to go away.
while not ble.connected:
pass
print("connected")
while ble.connected:
if uart.in_waiting:
print("got", uart.read(uart.in_waiting))
uart.write(str(time.monotonic()).encode())
time.sleep(2)
print("disconnected")