Skip to content
Simple serial command line prompt for Arduino. Originally developed by Akiba from @freaklabs
Branch: master
Clone or download
Pull request Compare This branch is 6 commits ahead of fakufaku:master.
joshmarinacci Merge pull request #1 from jan-r/bugfix/ConstCorrectness
Remove compiler warning, fix examples
Latest commit fedd8f2 Jun 5, 2017
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples Fix examples May 25, 2017
Cmd.cpp Fix examples May 25, 2017
Cmd.h Fix examples May 25, 2017 moved the readme, updated it Jul 31, 2014
keywords.txt First commit Dec 29, 2011

== CmdArduino

CmdArduino is a small library to parse commands from the Serial port or anything else which implements the Stream API. It is based on the original by Akiba at

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:

void left(int arg_cnt, char **args) {

void right(int arg_cnt, char **args) {

void setup() {

Call cmdInit with a pointer to the stream you are using. Call cmdAdd to attach a string command to the command function. Now you can type left or right into your serial port to command the robot. The serial port will be parsed using newline, \n, as the delimiter. The command name should be the first item and any arguments after that. For example, to tell the robot to turn left for three seconds, type in:

left 3000\n

Then the left function becomes

void left(int arg_cnt, char **args) {
    int time = 200;
    if(arg_cnt > 0) {
        time = parseNum(args[0]);

== original readme

The Arduino Command Line Interface, aka CmdArduino, is a simple shell that can be run on an Arduino. 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. Using it is fairly simple and just requires unzipping the files into the "Arduino/libraries" sub-directory in the Arduino program folder.

You can’t perform that action at this time.