Home Documentation Tutorials API GitHub

Uart

The Uart API allows you to communicate over serial UART interfaces.

Basics

Open and close a serial port using open and close:

uart := Uart.open("ttyS0", UartConfig {})
uart.close

Read and write data using the standard Fantom I/O streams with in and out:

uart.in.readLine
uart.out.printLine("foobar")

Enumerating Ports

Uart.list will enumerate the current serial ports as a Str:Obj map, where the keys are the port names and the values are the available meta-data about each port:

Uart.list =>
  [ "ttyS0": [:],
    "ttyUSB1": ["desc":"USB Serial Port", "man":"FTDI", "pid":24577, "vid":1027]
  ]