diff options
Diffstat (limited to 'libraries/Bridge/examples/ShellCommands/ShellCommands.ino')
-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..4fd7384 --- /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 name of the wireless that the board is connected to or that the board has created + p.runShellCommand(F("lua /usr/lib/lua/pretty_wifi_info.lua | grep SSID")); + + // Read command output + while (p.available()) { + char c = p.read(); + Console.print(c); + } + Console.flush(); + + delay(5000); +} + |