Skip to content

Commit 5d102a5

Browse files
committed
modifide comments in Yun examples ShellCommands.ino ConsolePixel.ino
1 parent 2b4346b commit 5d102a5

File tree

2 files changed

+20
-14
lines changed

2 files changed

+20
-14
lines changed

hardware/arduino/avr/libraries/Bridge/examples/ConsolePixel/ConsolePixel.ino

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
it receives the character 'H', and turns off the LED when it
77
receives the character 'L'.
88
9-
To see the Console, pick your Yun's name and IP address in the Port menu
9+
To see the Console, pick your Yún's name and IP address in the Port menu
1010
then open the Port Monitor. You can also see it by opening a terminal window
1111
and typing
1212
ssh root@ yourYunsName.local 'telnet localhost 6571'
@@ -24,17 +24,21 @@
2424
This example code is in the public domain.
2525
2626
*/
27+
2728
#include <Console.h>
2829

2930
const int ledPin = 13; // the pin that the LED is attached to
3031
char incomingByte; // a variable to read incoming Console data into
3132

3233
void setup() {
33-
// initialize Console communication:
34-
Bridge.begin();
35-
Console.begin();
36-
while(!Console); // wait for the Console to open from the remote side
34+
Bridge.begin(); // Initialize Bridge
35+
Console.begin(); // Initialize Console
36+
37+
// Wait for the Console port to connect
38+
while(!Console);
39+
3740
Console.println("type H or L to turn pin 13 on or off");
41+
3842
// initialize the LED pin as an output:
3943
pinMode(ledPin, OUTPUT);
4044
}

hardware/arduino/avr/libraries/Bridge/examples/ShellCommands/ShellCommands.ino

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
/*
3-
Running shell coommands using Process class.
3+
Running shell commands using Process class.
44
55
This sketch demonstrate how to run linux shell commands
66
using an Arduino Yún. It runs the wifiCheck script on the linino side
@@ -23,9 +23,11 @@
2323
#include <Process.h>
2424

2525
void setup() {
26-
// initialize the Bridge and Serial connections:
27-
Bridge.begin();
28-
Serial.begin(9600);
26+
Bridge.begin(); // Initialize the Bridge
27+
Serial.begin(9600); // Initialize the Serial
28+
29+
// Wait until a Serial Monitor is connected.
30+
while(!Serial);
2931
}
3032

3133
void loop() {
@@ -40,12 +42,12 @@ void loop() {
4042

4143
// Read command output. runShellCommand() should have passed "Signal: xx&":
4244
while (p.available()) {
43-
int result = p.parseInt(); // look for an integer
44-
int signal = map(result, 0, 100, 0, 255); // map result from 0-100 range to 0-255
45-
analogWrite(9, signal); // set the brightness of LED on pin 9
46-
Serial.println(result); // print the number as well
45+
int result = p.parseInt(); // look for an integer
46+
int signal = map(result, 0, 100, 0, 255); // map result from 0-100 range to 0-255
47+
analogWrite(9, signal); // set the brightness of LED on pin 9
48+
Serial.println(result); // print the number as well
4749
}
48-
delay(5000); // wait 5 seconds before you do it again
50+
delay(5000); // wait 5 seconds before you do it again
4951
}
5052

5153

0 commit comments

Comments
 (0)