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 = uart.read(3) # convert bytearray to string data_string = ''.join([chr(b) for b in data]) print(data_string, end="") uart.write('hello world') uart.deinit()