mirror of
https://github.com/taigrr/arduinolibs
synced 2025-01-18 04:33:12 -08:00
Rename Terminal library to Shell library
This commit is contained in:
35
libraries/Shell/examples/SerialShell/SerialShell.ino
Normal file
35
libraries/Shell/examples/SerialShell/SerialShell.ino
Normal file
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
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();
|
||||
}
|
||||
Reference in New Issue
Block a user