7
7
created 5 Jun 2013
8
8
by Cristian Maglie
9
9
10
+ This example code is in the public domain.
11
+
10
12
*/
11
13
12
14
#include < Process.h>
13
15
14
16
void setup () {
15
- // Setup Bridge (needed every time we communicate with the Arduino Yún)
17
+ // Initialize Bridge
16
18
Bridge.begin ();
17
19
18
- // Setup Console
19
- Console.begin ();
20
- // Buffering improves Console performance, but we must remember to
21
- // finish sending using the Console.flush() command.
22
- Console.buffer (64 );
20
+ // Initialize Serial
21
+ Serial.begin (9600 );
23
22
24
- // Wait until a Network Monitor is connected.
25
- while (!Console );
23
+ // Wait until a Serial Monitor is connected.
24
+ while (!Serial );
26
25
27
26
// run various example processes
28
27
runCurl ();
@@ -34,37 +33,38 @@ void loop() {
34
33
}
35
34
36
35
void runCurl () {
37
- // Launch "curl" command and get Arduino asciilogo from the network
38
-
39
- Process p; // Create a process and call it "p"
40
- p.begin (" curl" ); // Process should launch the "curl" command
36
+ // Launch "curl" command and get Arduino ascii art logo from the network
37
+ // curl is command line program for transferring data using different internet protocols
38
+ Process p; // Create a process and call it "p"
39
+ p.begin (" curl" ); // Process that launch the "curl" command
41
40
p.addParameter (" http://arduino.cc/asciilogo.txt" ); // Add the URL parameter to "curl"
42
- p.run (); // Run the process and wait for its termination
41
+ p.run (); // Run the process and wait for its termination
43
42
44
- // Print arduino logo over the console.
43
+ // Print arduino logo over the Serial
45
44
// A process output can be read with the stream methods
46
45
while (p.available ()>0 ) {
47
46
char c = p.read ();
48
- Console .print (c);
47
+ Serial .print (c);
49
48
}
50
- // Ensure the latest bit of data is sent.
51
- Console .flush ();
49
+ // Ensure the last bit of data is sent.
50
+ Serial .flush ();
52
51
}
53
52
54
53
void runCpuInfo () {
55
54
// Launch "cat /proc/cpuinfo" command (shows info on Atheros CPU)
56
- Process p;
57
- p.begin (" cat" );
58
- p.addParameter (" /proc/cpuinfo" );
59
- p.run ();
55
+ // cat is a command line utility that shows the content of a file
56
+ Process p; // Create a process and call it "p"
57
+ p.begin (" cat" ); // Process that launch the "cat" command
58
+ p.addParameter (" /proc/cpuinfo" ); // Add the cpuifo file path as parameter to cut
59
+ p.run (); // Run the process and wait for its termination
60
60
61
- // Print command output on the Console .
61
+ // Print command output on the Serial .
62
62
// A process output can be read with the stream methods
63
63
while (p.available ()>0 ) {
64
64
char c = p.read ();
65
- Console .print (c);
65
+ Serial .print (c);
66
66
}
67
- // Ensure the latest bit of data is sent.
68
- Console .flush ();
67
+ // Ensure the last bit of data is sent.
68
+ Serial .flush ();
69
69
}
70
70
0 commit comments