aboutsummaryrefslogtreecommitdiff
path: root/libraries/Bridge/examples/ShellCommands/ShellCommands.ino
blob: 4fd73843e0b5913d70d6e439ce1a36845c5aab16 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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);
}