77 created 5 Jun 2013
88 by Cristian Maglie
99
10+ This example code is in the public domain.
11+
1012 */
1113
1214#include < Process.h>
1315
1416void setup () {
15- // Setup Bridge (needed every time we communicate with the Arduino Yún)
17+ // Initialize Bridge
1618 Bridge.begin ();
1719
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 );
2322
24- // Wait until a Network Monitor is connected.
25- while (!Console );
23+ // Wait until a Serial Monitor is connected.
24+ while (!Serial );
2625
2726 // run various example processes
2827 runCurl ();
@@ -34,37 +33,38 @@ void loop() {
3433}
3534
3635void 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
4140 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
4342
44- // Print arduino logo over the console.
43+ // Print arduino logo over the Serial
4544 // A process output can be read with the stream methods
4645 while (p.available ()>0 ) {
4746 char c = p.read ();
48- Console .print (c);
47+ Serial .print (c);
4948 }
50- // Ensure the latest bit of data is sent.
51- Console .flush ();
49+ // Ensure the last bit of data is sent.
50+ Serial .flush ();
5251}
5352
5453void runCpuInfo () {
5554 // 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
6060
61- // Print command output on the Console .
61+ // Print command output on the Serial .
6262 // A process output can be read with the stream methods
6363 while (p.available ()>0 ) {
6464 char c = p.read ();
65- Console .print (c);
65+ Serial .print (c);
6666 }
67- // Ensure the latest bit of data is sent.
68- Console .flush ();
67+ // Ensure the last bit of data is sent.
68+ Serial .flush ();
6969}
7070
0 commit comments