#define redled 4
int ledState = LOW;
unsigned long previousMillis = 0;
const long interval = 1000;
void setup() {
// put your setup code here, to run once:
}
void loop() {
unsigned long currentMillis = millis();
if (currentMillis - previousMillis >= interval) {
// save the last time you blinked the LED
previousMillis = currentMillis;
// if the LED is off turn it on and vice-versa:
if (ledState == LOW) {
ledState = HIGH;
} else {
ledState = LOW;
}
// set the LED with the ledState of the variable:
digitalWrite(redled, ledState);
}
}