This library allows to build a ‘bash’-like user interface via a serial connection (preferably a CAN2SER connection via CAN bus). In its simplest form, it welcomes the user and provides a login (via password or iButton).

To use this library

#include "consoleLogin.h"

Example

The following example creates a console on Serial (which is the ‘serial over can’ – CAN2SER instance on MCAN0 ).

#include "consoleLogin.h"
void setup()
{
  console_init(&Serial);
}

void loop()
{
  String s_console_string = s_console_routine();
  if(s_console_string.equals("myCmd"))
     Serial.println("do things here ....");
}

It also shows how to add your own commands to it. s_console_routine() returns the command entered by user if it was not recognised as an internal command (like flash, reset, passwd, get app or logout).

The Console library is using the CAN2SER protocol which makes it possible to establish console-terminals for numerous dice devices on the same CAN bus simultaneously.

Console library notes & features

Console functions work on any serial interface that derive from HardwareSerial such as Serial (CAN2SER), SerialUSB (dice-USB) or RS232_1(dice-RS232).

Note that the utility console functions do not initialise any hardware components that they use. So for example: if an application makes use of any SerialFlash console commands, the application has to initialise it first SerialFlash.begin(); in the setup() section.

Further information

The consoleLogin.h function serve as the basis for user created console applications.

The other console header-files and functions should mainly be seen as code examples for the functions of the dice hardware and its libraries.

C:\Users\yourName\AppData\Local\Arduino15\packages\dice\hardware\samc\1.0.0\libraries\Console\src\...

The example application
File -> Examples -> Consoles -> Console_Dev
is the “master” console application that includes all available functions. It can be compiled for every device variant. The compile results will be different according to the devices capabilities. So for example, if compiled for a dice-Wifi then the result will provide functions such as “wifi connect” which will not appear in case of an dice-CPU.