// Constants, variables const int ledPin = 2; // the number of the LED pin long previousMillis = 0; // will store last time LED was updated long interval = 1000; // interval at which to blink (milliseconds) void setup() { // set the digital pin as output: pinMode(ledPin, OUTPUT); } void loop() { // check to see if it's time to blink the LED; that is, if the // difference between the current time and last time you blinked // the LED is bigger than the interval at which you want to // blink the LED. unsigned long currentMillis = millis(); if(currentMillis - previousMillis > interval) { // save the last time you blinked the LED previousMillis = currentMillis; // set the LED with the ledState of the variable: digitalWrite(ledPin, HIGH); delay(100); digitalWrite(ledPin, LOW); } }