Update: a new updated version is out! This is version 3, 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 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.
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:
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
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. Especially if you use the drag & drop GUI builder!
More SerialUI information: