int ledPin = 13;
int ledState = LOW;
unsigned long previousMillis = 0;
long interval = 1000;
void setup() {
pinMode(ledPin, OUTPUT); // put your setup code here, to run once:
}
void loop() {
unsigned long currentMillis = millis(); // put your main code here, to run repeatedly:
if (currentMillis - previousMillis > interval){
previousMillis = currentMillis ;
if (ledState == LOW)
ledState= HIGH;
else
ledState = LOW ;
digitalWrite(ledPin, ledState);
}
}