Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit cf41009

Browse files
Update README.md
1 parent d3bb904 commit cf41009

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

‎README.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,35 +112,26 @@ The above code uses Socket.io to listen for a message from the HTML/JavaScript w
112112
Using [Arduino Create](https://create.arduino.cc/editor) create the following sketch and upload it to your Arduino.
113113

114114
```csharp
115-
// Define the port for the LED
116115
int lightPin = 2;
117116

118117
void setup()
119118
{
120-
// Initialize the light pin
121119
pinMode(lightPin, OUTPUT);
122-
123-
// Initialize the Serial
124120
Serial.begin(9600);
125121
}
126122

127123
void loop() {
128124

129-
// CHeck to see if Serial data is being received
130125
if (Serial.available() > 0) {
131126

132-
// Create a new string variable to receive Serial data
133127
String receivedString = "";
134128

135-
// Loop through received data and append to the receivedString variable
136129
while (Serial.available() > 0) {
137130
receivedString += char(Serial.read ());
138131
}
139132

140-
// Print received Serial data
141133
Serial.println(receivedString);
142134

143-
// Change LED status based on received data
144135
if(receivedString == "1")
145136
digitalWrite(lightPin,HIGH);
146137
else
@@ -153,7 +144,7 @@ void loop() {
153144

154145
The previous code will listen to the serialport for an incoming message. Once a message is received, if the message is a one the light will turn on, if the message is a zero the light will turn off.
155146

156-
[View the Arduino code on Arduino Create](https://create.arduino.cc/editor/professoradam/da29d7ec-2df5-4528-82ce-817710aadb1a/preview)
147+
[View the Arduino code on Arduino Create](https://create.arduino.cc/editor/professoradam/af5288bf-00cc-406c-844e-f20485fa2df8/preview)
157148

158149
You will need to setup the following circuit using your Arduino:
159150

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /