Created
December 15, 2017 23:53
-
-
Save dvsseed/a816bf62c0d3505bbd5be62a7532e69c to your computer and use it in GitHub Desktop.
For ESP-01 blink sample on Arduino
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 LED_BUILTIN to find the pin with the internal LED | |
*/ | |
void setup() { | |
pinMode(LED_BUILTIN, OUTPUT); // Initialize the LED_BUILTIN pin as an output | |
Serial.begin(115200); | |
} | |
// the loop function runs over and over again forever | |
void loop() { | |
digitalWrite(LED_BUILTIN, 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 | |
Serial.println("led off"); | |
delay(250); // Wait for one-quarter of second | |
digitalWrite(LED_BUILTIN, HIGH); // Turn the LED off by making the voltage HIGH | |
delay(2000); // Wait for two seconds (to demonstrate the active low LED) | |
Serial.println("led on"); | |
delay(250); // Wait for one-quarter of second | |
} |
I just tried this out on an ESP-01 I've had for a while. It generally worked as desired. In my case the serial port and GPIO1 (which drives the blue builtin LED) share the same pin so I can't use both at the same time.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just tried this sketch. It loads fine onto two different ESP01 modules, however no LED is blinking on either one.