SerialUI

Update: a new updated version is out!  This is version 2, so it may break compatibility in some ways with prior iterations.  Updates to the documentation here forthcoming…

 

For now, you can download the library and install it in the Arduino IDE by going to Sketch -> Include Library -> Add .ZIP library, then check the included examples (which were generated using Druid Builder and show all the basics).

 

SerialUI: A Serial User Interface for embedded devices, namely Arduinos.

SerialUI is useful when you want to provide a user interface through the serial channel (menus, sub-menus and command execution). It provides built-in support for navigation through the menu hierarchy and online help.

SerialUI is released under the terms of the GNU LGPL, see the included LICENSE.txt file for details.

Overview

With SerialUI, you can create a hierarchy of menus and sub-menus of arbitrary depth (limited only by ROM/RAM space).

Each menu contains a list of menu items. There are three types of SerialUI menu items:

  • Sub menus: lead you to another level of menu items
  • Commands: actually perform some type of action
  • Input Requests: a better way to get data from users.

Using SerialUI, you can create any serial user interface. Here’s an example menu system you could set up:

  • information
  • enable
    • on
    • off
  • settings
    • red
    • green
    • blue
    • deviceid
    • show

So, here we’d have a three-option top level menu (information, enable, settings) with two of those options leading to sub-menus.

Every “leaf” (option that doesn’t lead to a sub-menu) is a command that uses a callback specified when setting up the menu item.

Exactly what happens when a user issues a command is determined by callback implementations (functions).

A few commands are built-in and don’t need to be defined:

  • ?
    Help, which displays all the available menu keys and help messages, where defined.
  • ..
    Up, which moves up to a parent menu from a sub-menu
  • quit
    Exit the SerialUI interface (available in top level menu).

GUI and Demo

But wait, there’s more!  Yes, use SerialUI now (as of version 2.x) and you get a free graphical user interface, thanks to Device Druid.  You don’t need to use druid but should you want to provide a GUI then there’s no additional work involved.

 

If you’re interested in using SerialUI, see the examples/usage info and then download the code.

More SerialUI information: