This example program demonstrates reading from a serial terminal, as described in Text Output and Input.

It uses one core only, and the kernel. There are two threads:

  • thread 0: blink LED, to check if our terminal reading is blocking
  • thread 1: read strings and integers from the terminal

Thread 1 runs two loops:

  • read string: check buffer overflows, FIFO overruns
  • read integer: check syntax and out of limits inputs

Entering an empty input switches between the two loops.

Experiment with different buffer sizes and baud-rates, see also Text Output and Input, section Design Considerations.

See modules

IO Terminal

See Set-up, one-terminal set-up.

Set (PuTTY):

  • Terminal: local echo and local line editing to Force on
  • Speed (baud): 38400

Build and Run

Build module ReadTerminal with Astrobe, and create and upload the UF2 file using abin2uf2.

Set Astrobe’s memory options as listed, and the library search path as explained.