aboutsummaryrefslogtreecommitdiff
path: root/libraries/Bridge/examples/ShellCommands/ShellCommands.ino
blob: a362ed83afd71d454cf2d22b4f3d7e6ada803a78 (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 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);
}