This example uses Adafruit’s busio package to create a UART object. It will read 3 characters from the FTDI cable which CoolTerm (Windows) or other terminal emulator is connected to.  The script then sends ‘hello world’ to the FTDI cable which will display in the terminal.

import board
import busio

uart = busio.UART(board.TX, board.RX, 115200, 8, None, 1, 1000)
data =
# convert bytearray to string
data_string = ''.join([chr(b) for b in data])
print(data_string, end="")
uart.write('hello world')

This guide was first published on Dec 18, 2019. It was last updated on Mar 08, 2024.

This page (Example Code) was last updated on Mar 08, 2024.

Text editor powered by tinymce.