diff options
author | Cristian Maglie <c.maglie@bug.st> | 2013-06-12 13:28:24 +0200 |
---|---|---|
committer | Cristian Maglie <c.maglie@bug.st> | 2013-06-12 13:28:24 +0200 |
commit | 406c20222affa4940c4b90b42e8cc22cbe10c5e2 (patch) | |
tree | 92c5a774c82fb8e8e86040610cbdf517881eb804 /libraries/Bridge/examples | |
parent | 8674a1b9e9da542b729d660d8f996f0e58008dbd (diff) |
Added Process.runShellCommand*() methods.
Diffstat (limited to 'libraries/Bridge/examples')
-rw-r--r-- | libraries/Bridge/examples/ShellCommands/ShellCommands.ino | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libraries/Bridge/examples/ShellCommands/ShellCommands.ino b/libraries/Bridge/examples/ShellCommands/ShellCommands.ino new file mode 100644 index 0000000..a362ed8 --- /dev/null +++ b/libraries/Bridge/examples/ShellCommands/ShellCommands.ino @@ -0,0 +1,26 @@ + +/* Demonstrate shell commands */ + +#include <Process.h> + +void setup() { + Bridge.begin(); + Console.begin(); + Console.buffer(64); +} + +void loop() { + Process p; + // This command line prints the number of bytes received and transmitted from WLAN + p.runShellCommand(F("ifconfig wlan0 | grep \"RX bytes\" | tr ':' ' ' | awk \"{ print \\$3 \\\" \\\" \\$8 }\"\n")); + + // Read command output + while (p.available()) { + char c = p.read(); + Console.print(c); + } + Console.flush(); + + delay(5000); +} + |