Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
2 contributors

Users who have contributed to this file

@kattni @craigargh
24 lines (16 sloc) 534 Bytes
# CircuitPython Demo - USB/Serial echo
import board
import busio
import digitalio
led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT
uart = busio.UART(board.TX, board.RX, baudrate=9600)
while True:
data = uart.read(32) # read up to 32 bytes
# print(data) # this is a bytearray type
if data is not None:
led.value = True
# convert bytearray to string
data_string = ''.join([chr(b) for b in data])
print(data_string, end="")
led.value = False
You can’t perform that action at this time.