Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions examples/ble_uart_printmessage_test
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import board
from adafruit_ble.uart import UARTServer

# Adapted from "Getting Started with CircuitPython and Bluetooth Low Energy" by Kattni Rembor
# from https://learn.adafruit.com/circuitpython-nrf52840/overview

uart_server = UARTServer()


while True:
uart_server.start_advertising()
while not uart_server.connected:
pass

# Now we're connected

while uart_server.connected:
if uart_server.in_waiting:
uartread = str(uart_server.readline())
# Remove the start indicator and the ending return /n
message = uartread[2:-3]
print(message)


# If we got here, we lost the connection. Go up to the top and start
# advertising again and waiting for a connection.