SerialUI

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: A Serial User Interface for embedded devices, namely Arduinos. including nRF-based Bluetooth Low Energy boards and starting with version 3, even Raspberry Pi.

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.  Especially if you use the drag & drop GUI builder!

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

More SerialUI information: [subpages]

2 thoughts on “SerialUI”

  • Trying to use your library on Arduino version 1.6.6 with a Due board and I cannot seem to get it compiles. The errors is a follows and seems like it is within your C code.


    Arduino: 1.6.6 (Windows 7), Board: “Arduino Due (Native USB Port)”

    Warning: platform.txt from core ‘Arduino ARM (32-bits) Boards’ contains deprecated recipe.ar.pattern=”{compiler.path}{compiler.ar.cmd}” {compiler.ar.flags} {compiler.ar.extra_flags} “{build.path}/{archive_file}” “{object_file}”, automatically converted to recipe.ar.pattern=”{compiler.path}{compiler.ar.cmd}” {compiler.ar.flags} {compiler.ar.extra_flags} “{archive_file_path}” “{object_file}”. Consider upgrading this core.
    C:\Program Files (x86)\Arduino\libraries\SerialUI\SUIMenu.cpp: In member function ‘SUI::Menu* SUI::Menu::handleRequest()’:

    C:\Program Files (x86)\Arduino\libraries\SerialUI\SUIMenu.cpp:552:68: error: ‘strncmp_P’ was not declared in this scope

    if (parent_menu && strncmp_P(key_entered, up_key, strlen_P(up_key)) == 0) {

    ^

    C:\Program Files (x86)\Arduino\libraries\SerialUI\SUIMenu.cpp:562:57: error: ‘strncmp_P’ was not declared in this scope

    if (strncmp_P(key_entered, help_key, strlen_P(help_key)) == 0) {
    // etc etc…
    exit status 1
    Error compiling.

    This report would have more information with
    “Show verbose output during compilation”
    enabled in File > Preferences.

    I love what your library and Druid are suppose to do, and would love to use them in my project, but if I cannot load the library I cannot get it to work. Thanks for making this, look forward to hearing from you.

Leave a Reply