99 * Note: on most Arduinos, there is already an LED on the board
1010 that's attached to pin 13, so no hardware is needed for this example.
1111
12-
1312 created 2005
1413 by David A. Mellis
1514 modified 8 Feb 2010
1615 by Paul Stoffregen
16+ modified 11 Nov 2013
17+ by Scott Fitzgerald
18+
1719
1820 This example code is in the public domain.
19-
2021
2122 http://www.arduino.cc/en/Tutorial/BlinkWithoutDelay
2223 */
2324
24- // constants won't change. Used here to
25- // set pin numbers:
25+ // constants won't change. Used here to set a pin number :
2626const int ledPin = 13 ; // the number of the LED pin
2727
28- // Variables will change:
28+ // Variables will change :
2929int ledState = LOW; // ledState used to set the LED
30- long previousMillis = 0 ; // will store last time LED was updated
3130
32- // the follow variables is a long because the time, measured in miliseconds,
33- // will quickly become a bigger number than can be stored in an int.
34- long interval = 1000 ; // interval at which to blink (milliseconds)
31+ // Generally, you shuould use "unsigned long" for variables that hold time
32+ // The value will quickly become too large for an int to store
33+ unsigned long previousMillis = 0 ; // will store last time LED was updated
34+
35+ // constants won't change :
36+ const long interval = 1000 ; // interval at which to blink (milliseconds)
3537
3638void setup () {
3739 // set the digital pin as output:
@@ -48,7 +50,7 @@ void loop()
4850 // blink the LED.
4951 unsigned long currentMillis = millis ();
5052
51- if (currentMillis - previousMillis > interval) {
53+ if (currentMillis - previousMillis >= interval) {
5254 // save the last time you blinked the LED
5355 previousMillis = currentMillis;
5456
0 commit comments