Each console application needs to include console_login.h that provides the basic functions:

  • void console_init( HardwareSerial* opSer, String os_password ); – initializes the console interface and loads the password (if set) and the iButton ID from the FlashStorage.
  • String s_console_routine(); – reads and returns a new command from the console interface from the user. Returns straight away if no new input is available. It provides and processes the following user command:
    • flash n – lets the LED blink n times
    • passwd <pass> – change login password; leave blank to disable the password protection
    • teach iButton – reads in iButton for Logon
    • get app – returns name and version of the application
    • reset – resets the device
    • logout – logging out from console

Syntax (examples)

console_init( &Serial );


HardwareSerial* opSer – pointer to the serial interface that should provide a console (typically &Serial )

String os_password – a ‘hardcoded’ login password for the console, which can not be changed. If omitted, the password can be set / modified by the user.


s_console_routine() returns:
String :
command input String – from the user or
empty Sting “” – if there is no new command input from the console user or the cmd was recognised as one of command listed above and already processed. So if the users enters “flash 4”, the function s_console_routine() will let the on board led blink 4 times and returns an empty string.

Example Codes:

#include "consoleLogin.h"
void setup()
void loop()
  String s_console_string = s_console_routine();
     Serial.println("do things here ....");

The example shows how to add your own commands to it. The s_console_routine() returns the command-String from the user if it was not recognised as an internal command (like flash, reset, passwd, get app or logout).

Notes and Warnings

An example can be found in the Arduino IDE menu:
File -> Examples -> Consoles -> SimpleConsole

See also