If you are using boards Arduino Nano, Uno or Mega series, you must install first the Arduino STL to use this library to support C++11!!!
Just download both libraries with "download as zip" from GitHub and install on Arduino IDE.
To quick usage ConsoleControl you must install Stardard C++ Arduino, initialize the console with a user's password, register the required commands and call ConsoleControl::loop function in arduino's loop as the example above. You may use inline C++ functions as you wish:
#include <ConsoleControl.h>
ConsoleControl console(Serial, 9600, "password");
void setup() {
Serial.begin(9600);
console.on("example", [] (String cmd, ConsoleControl::CommandArgs args) -> void {
//do stuff
});
}
void loop() {
console.loop();
}
ConsoleControl::CommandArgs is a std::vector and his methods is identical as stardard C++.
Starts the console's functionality and defines a security password.
Is required to call that function in arduino's loop. This function waits for data on Serial port and run the command.
binds a function to an command call. The callback receives a String containing the command name, and a std::vector with the arguments.
command
name of the command
callback
callback function
Function signature must be
void (const String, std::vector<String>)
void callback(const String cmd, std::vector<String> args) {
//do stuff
}
console.on("example", callback);
login
- takes password as parameter. After login, gives user authorization to run other commandslogout
- logout user and removes rightsreset
- software reset arduino
removes command from commands list. Useful if you want to disable any command at runtime.
- See the SimpleExample for more information.
- NANO
- UNO
- MEGA 1280 and MEGA 2560
- NODEMCU and ESP8266 series