A Wiring/Arduino library to tokenize and parse commands received over a serial port.
additional usage for using custom serial object.
- With default (Serial)
#include <SerialCommand.h>
SerialCommand parser;
- With Custom Serial
#include <SerialCommand.h>
SerialCommand parser(Serial2);
- With Custom Serial, and custom debug
#include <SerialCommand.h>
#define SERIALCOMMAND_DEBUG
SerialCommand parser(Serial2, Serial3);
- With Custom Serial and terminator
#include <SerialCommand.h>
SerialCommand parser(Serial2, '\r');
With PlatformIO those defines can be set in the platformio.ini
:
build_flags =
-DSERIALCOMMAND_DEBUG
-DSERIALCOMMAND_BUFFER=64
-DSERIALCOMMAND_MAXCOMMANDLENGTH=16
This version advances the extended version by Mingyu Kim.
The original version of this library was written by Steven Cogswell (published May 23, 2011 in his blog post "A Minimal Arduino Library for Processing Serial Commands").
This is a heavily modified version with smaller footprint and a cleaned up code by Stefan Rado.