Added comment to some examples
This commit is contained in:
parent
f9b4abe2b5
commit
01b88f7d75
|
@ -29,7 +29,7 @@ void setup() {
|
||||||
Bridge.begin();
|
Bridge.begin();
|
||||||
Console.begin();
|
Console.begin();
|
||||||
|
|
||||||
// Uncomment the followinf line to enable buffering:
|
// Uncomment the following line to enable buffering:
|
||||||
// - better transmission speed and efficiency
|
// - better transmission speed and efficiency
|
||||||
// - needs to call Console.flush() to ensure that all
|
// - needs to call Console.flush() to ensure that all
|
||||||
// transmitted data is sent
|
// transmitted data is sent
|
||||||
|
@ -81,6 +81,9 @@ void loop() {
|
||||||
|
|
||||||
// if printed last visible character '~' or 126, stop:
|
// if printed last visible character '~' or 126, stop:
|
||||||
if(thisByte == 126) { // you could also use if (thisByte == '~') {
|
if(thisByte == 126) { // you could also use if (thisByte == '~') {
|
||||||
|
// ensure the latest bit of data is sent
|
||||||
|
Console.flush();
|
||||||
|
|
||||||
// This loop loops forever and does nothing
|
// This loop loops forever and does nothing
|
||||||
while(true) {
|
while(true) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -14,9 +14,13 @@
|
||||||
void setup() {
|
void setup() {
|
||||||
// Setup Bridge (needed every time we communicate with the Arduino Yún)
|
// Setup Bridge (needed every time we communicate with the Arduino Yún)
|
||||||
Bridge.begin();
|
Bridge.begin();
|
||||||
|
|
||||||
// Setup Console
|
// Setup Console
|
||||||
Console.begin();
|
Console.begin();
|
||||||
|
// Buffering improves Console performance, but we must remember to
|
||||||
|
// finish sending using the Console.flush() command.
|
||||||
Console.buffer(64);
|
Console.buffer(64);
|
||||||
|
|
||||||
// Wait until a Network Monitor is connected.
|
// Wait until a Network Monitor is connected.
|
||||||
while (!Console);
|
while (!Console);
|
||||||
|
|
||||||
|
@ -31,16 +35,19 @@ void loop() {
|
||||||
|
|
||||||
void runCurl() {
|
void runCurl() {
|
||||||
// Launch "curl" command and get Arduino asciilogo from the network
|
// Launch "curl" command and get Arduino asciilogo from the network
|
||||||
Process p;
|
|
||||||
p.begin("curl");
|
Process p; // Create a process and call it "p"
|
||||||
p.addParameter("http://arduino.cc/asciilogo.txt");
|
p.begin("curl"); // Process should launch the "curl" command
|
||||||
p.run();
|
p.addParameter("http://arduino.cc/asciilogo.txt"); // Add the URL parameter to "curl"
|
||||||
|
p.run(); // Run the process and wait for its termination
|
||||||
|
|
||||||
// Print arduino logo over the console
|
// Print arduino logo over the console.
|
||||||
|
// A process output can be read with the stream methods
|
||||||
while (p.available()>0) {
|
while (p.available()>0) {
|
||||||
char c = p.read();
|
char c = p.read();
|
||||||
Console.print(c);
|
Console.print(c);
|
||||||
}
|
}
|
||||||
|
// Ensure the latest bit of data is sent.
|
||||||
Console.flush();
|
Console.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,11 +58,13 @@ void runCpuInfo() {
|
||||||
p.addParameter("/proc/cpuinfo");
|
p.addParameter("/proc/cpuinfo");
|
||||||
p.run();
|
p.run();
|
||||||
|
|
||||||
// Print command output on the Console
|
// Print command output on the Console.
|
||||||
|
// A process output can be read with the stream methods
|
||||||
while (p.available()>0) {
|
while (p.available()>0) {
|
||||||
char c = p.read();
|
char c = p.read();
|
||||||
Console.print(c);
|
Console.print(c);
|
||||||
}
|
}
|
||||||
|
// Ensure the latest bit of data is sent.
|
||||||
Console.flush();
|
Console.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue