Skip to content

Commit

Permalink
Use BUILTIN_LED
Browse files Browse the repository at this point in the history
  • Loading branch information
probonopd authored and igrr committed Jun 26, 2015
1 parent 3e87bb3 commit 2969b0b
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions libraries/esp8266/examples/Blink/Blink.ino
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,23 @@
ESP8266 Blink by Simon Peter
Blink the blue LED on the ESP-01 module
This example code is in the public domain
The blue LED on the ESP-01 module is connected to GPIO1
(which is also the TXD pin; so we cannot use Serial.print() at the same time)
Note that this sketch uses BUILTIN_LED to find the pin with the internal LED
*/

const int ledPin = 1; // The blue LED on the ESP-01 module is connected to GPIO1
// (which is also the TXD pin; so we cannot use
// Serial.print() at the same time

void setup() {
pinMode(ledPin, OUTPUT); // Initialize the ledPin as an output
pinMode(BUILTIN_LED, OUTPUT); // Initialize the BUILTIN_LED pin as an output
}

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

0 comments on commit 2969b0b

Please sign in to comment.