File tree 1 file changed +24
-9
lines changed
hardware/arduino/avr/libraries/Bridge/examples/ShellCommands
1 file changed +24
-9
lines changed Original file line number Diff line number Diff line change 1
1
2
- /* Demonstrate shell commands */
2
+ /*
3
+ Running shell coommands using Process class.
4
+
5
+ This sketch demonstrate how to run linux shell commands
6
+ using an Arduino Yún.
7
+
8
+ The circuit:
9
+ * Arduino Yun
10
+
11
+ created 12 Jun 2013
12
+ by Cristian Maglie
13
+ modified 21 June 2013
14
+ by Tom Igoe
15
+
16
+ This example code is in the public domain.
17
+
18
+ */
3
19
4
20
#include < Process.h>
5
21
6
22
void setup () {
23
+ // initialize the Bridge and Serial connections:
7
24
Bridge.begin ();
8
- Console.begin ();
9
- Console.buffer (64 );
25
+ Serial.begin (9600 );
10
26
}
11
27
12
28
void loop () {
13
29
Process p;
14
- // This command line prints the name of the wireless that the board is connected to or that the board has created
30
+ // This command line prints the name of the wireless network
31
+ // that the board is connected to, or the network which the board has created:
15
32
p.runShellCommand (F (" lua /usr/lib/lua/pretty_wifi_info.lua | grep SSID" ));
16
33
17
34
// Read command output
18
35
while (p.available ()) {
19
36
char c = p.read ();
20
- Console.print (c);
21
- }
22
- Console.flush ();
23
-
24
- delay (5000 );
37
+ Serial.print (c);
38
+ }
39
+ while (true ); // do nothing more
25
40
}
26
41
You can’t perform that action at this time.
0 commit comments