Skip to content

Commit 42dde93

Browse files
committed
Use LED_BUILTIN
Modified blink example to use LED_BUILTIN. In this way it works out of the box on each board
1 parent f2367cd commit 42dde93

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed

examples/01.Basics/Blink/Blink.ino

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,31 @@
22
Blink
33
Turns on an LED on for one second, then off for one second, repeatedly.
44
5-
Most Arduinos have an on-board LED you can control. On the Uno and
6-
Leonardo, it is attached to digital pin 13. If you're unsure what
7-
pin the on-board LED is connected to on your Arduino model, check
5+
Most Arduinos have an on-board LED you can control. On the UNO, MEGA and ZERO
6+
it is attached to digital pin 13, on MKR1000 on pin 6.
7+
If you're unsure what pin the on-board LED is connected to on your Arduino model, check
88
the documentation at http://www.arduino.cc
99
1010
This example code is in the public domain.
1111
1212
modified 8 May 2014
1313
by Scott Fitzgerald
14-
*/
14+
15+
modified 2 Sep 2016
16+
by Arturo Guadalupi
17+
*/
1518

1619

1720
// the setup function runs once when you press reset or power the board
1821
void setup() {
19-
// initialize digital pin 13 as an output.
20-
pinMode(13, OUTPUT);
22+
// initialize digital pin LED_BUILTIN as an output.
23+
pinMode(LED_BUILTIN, OUTPUT);
2124
}
2225

2326
// the loop function runs over and over again forever
2427
void loop() {
25-
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
26-
delay(1000); // wait for a second
27-
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
28-
delay(1000); // wait for a second
28+
digitalWrite(LED_BUILTIN, HIGH); // turn the LED on (HIGH is the voltage level)
29+
delay(1000); // wait for a second
30+
digitalWrite(LED_BUILTIN, LOW); // turn the LED off by making the voltage LOW
31+
delay(1000); // wait for a second
2932
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy