hey guys i'm just trying to get an led to come on for 3 seconds and then comeoff, without using delay, i'm not understanding the millis function but i've tried a bit. kindly let me know what i'm doing wrong. thank you.
int count = 0;
long previousMillis = 0;
long interval = 3000;
void setup() {
// set the digital pin as output:
pinMode(ledPin, OUTPUT);
}
void loop()
{
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval) {
previousMillis = currentMillis;
if (count <=1)
digitalWrite(ledPin,HIGH);
else
digitalWrite(ledPin,LOW);
count ++;
}
}






