1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-19 23:22:16 +03:00

Use BUILTIN_LED

This commit is contained in:
probonopd 2015-06-21 21:27:27 +02:00 committed by Ivan Grokhotkov
parent 2969b0b7a3
commit 496fee1a15

View File

@ -3,11 +3,12 @@
Blink the blue LED on the ESP-01 module Blink the blue LED on the ESP-01 module
Based on the Arduino Blink without Delay example Based on the Arduino Blink without Delay example
This example code is in the public domain This example code is in the public domain
*/
const int ledPin = 1; // The blue LED on the ESP-01 module is connected to GPIO1 The blue LED on the ESP-01 module is connected to GPIO1
// (which is also the TXD pin; so we cannot use (which is also the TXD pin; so we cannot use Serial.print() at the same time)
// Serial.print() at the same time
Note that this sketch uses BUILTIN_LED to find the pin with the internal LED
*/
int ledState = LOW; int ledState = LOW;
@ -15,7 +16,7 @@ unsigned long previousMillis = 0;
const long interval = 1000; const long interval = 1000;
void setup() { void setup() {
pinMode(ledPin, OUTPUT); pinMode(BUILTIN_LED, OUTPUT);
} }
void loop() void loop()
@ -27,7 +28,6 @@ void loop()
ledState = HIGH; // Note that this switches the LED *off* ledState = HIGH; // Note that this switches the LED *off*
else else
ledState = LOW; // Note that this switches the LED *on* ledState = LOW; // Note that this switches the LED *on*
digitalWrite(ledPin, ledState); digitalWrite(BUILTIN_LED, ledState);
} }
} }