Created
October 29, 2015 21:26
-
-
Save buildcircuit/bea2f7d606638dd73b1f to your computer and use it in GitHub Desktop.
ESP8266 LED Blink Project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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 | |
*/ | |
void setup() { | |
pinMode(BUILTIN_LED, OUTPUT); // Initialize the BUILTIN_LED pin as an output | |
// prepare GPIO2 | |
pinMode(2, OUTPUT); | |
digitalWrite(2, 0); | |
} | |
// the loop function runs over and over again forever | |
void loop() { | |
digitalWrite(BUILTIN_LED, LOW); // Turn the LED on (Note that LOW is the voltage level | |
digitalWrite(2, LOW); // 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 | |
digitalWrite(2, HIGH); | |
delay(2000); // Wait for two seconds (to demonstrate the active low LED) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment