1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00
2016-03-13 07:20:03 +10:00

36 lines
605 B
C++

/*
This example demonstrates how to create a simple shell on the serial port.
This example is placed into the public domain.
*/
#include <Shell.h>
Shell shell;
int ledPin = 13;
void cmdLed(Shell &shell, int argc, const ShellArguments &argv)
{
if (argc > 1 && !strcmp(argv[1], "on"))
digitalWrite(ledPin, HIGH);
else
digitalWrite(ledPin, LOW);
}
ShellCommand(led, "Turns the status LED on or off", cmdLed);
void setup()
{
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
shell.setPrompt("Command: ");
shell.begin(Serial, 5);
}
void loop()
{
shell.loop();
}