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