const int ledPin = LED_BUILTIN; //the number of the ledPin
//Variables will change
int ledState = 0; //set the ledstate to zero
unsigned long prev_millis = 0;
const long interval = 1000;//interval at which time to blink
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 current_millis = millis();
if(current_millis - prev_millis >= interval ){
prev_millis = current_millis;
//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(ledPin, ledState);
}
}