The Arduino Command Line Interface, aka cmdArduino, is a simple shell that can be run on an Arduino. It’s a small library to parse commands from the serial port on Arduino compatible boards.It’s nothing fancy and its main purpose is to allow users to easily call their functions on a running Arduino via a simple serial terminal. It also allows users to pass in arguments from the command line into the functions they wrote so they can easily toggle pins, set blinking speed, set pwm duty cycles, or whatever else might need command line user input.

The direct link to the github repository is here: Github Link

Alternatively, you can install it automatically using the Arduino library manager and searching for cmdArduino.

Or you can install it manually using the direct download link from github here.

To use it create your command functions, then wire them up in your setup function. All command functions must take int arg_cnt, char ** args as it’s parameters and return void. Here’s an example from a simple robot:

Call cmd.begin(baudrate)  to initialize the command line. Call cmd.add(<cmdName>, <cmdFunction>) to attach a command name to a command function. Open the Serial Monitor in the Arduino IDE. Make sure the baudrate is set correctly to what you have in the code, ie: in the above example, it’s 57600. Also make sure the line endings are set to “Carriage Return”. Then type <enter> and you should see the command line. You can now enter your commands.

If you type ‘hello’ at the command line, you get ‘Hello world!’ back.

If you type ‘blink 1000’ at the command line, the built-in LED on the board will blink with a duty cycle of 1 second, ie: 1 second ON, 1 second OFF.

Copy link