Skip to content

Commit 683cb48

Browse files
probonopdigrr
authored andcommitted
Use BUILTIN_LED
1 parent ae33d76 commit 683cb48

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

hardware/esp8266com/esp8266/libraries/esp8266/examples/Blink/Blink.ino

+12-11
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,23 @@
22
ESP8266 Blink by Simon Peter
33
Blink the blue LED on the ESP-01 module
44
This example code is in the public domain
5+
6+
The blue LED on the ESP-01 module is connected to GPIO1
7+
(which is also the TXD pin; so we cannot use Serial.print() at the same time)
8+
9+
Note that this sketch uses BUILTIN_LED to find the pin with the internal LED
510
*/
611

7-
const int ledPin = 1; // The blue LED on the ESP-01 module is connected to GPIO1
8-
// (which is also the TXD pin; so we cannot use
9-
// Serial.print() at the same time
10-
1112
void setup() {
12-
pinMode(ledPin, OUTPUT); // Initialize the ledPin as an output
13+
pinMode(BUILTIN_LED, OUTPUT); // Initialize the BUILTIN_LED pin as an output
1314
}
1415

1516
// the loop function runs over and over again forever
1617
void loop() {
17-
digitalWrite(ledPin, LOW); // turn the LED on (Note that LOW is the voltage level
18-
// but actually the LED is on; this is because
19-
// it is acive low on the ESP-01)
20-
delay(1000); // Wait for a second
21-
digitalWrite(ledPin, HIGH); // Turn the LED off by making the voltage HIGH
22-
delay(2000); // Wait for two seconds (to demonstrate the active low LED)
18+
digitalWrite(BUILTIN_LED, LOW); // Turn the LED on (Note that LOW is the voltage level
19+
// but actually the LED is on; this is because
20+
// it is acive low on the ESP-01)
21+
delay(1000); // Wait for a second
22+
digitalWrite(BUILTIN_LED, HIGH); // Turn the LED off by making the voltage HIGH
23+
delay(2000); // Wait for two seconds (to demonstrate the active low LED)
2324
}

0 commit comments

Comments
 (0)