Hi i really want to know how to write some code with some delay in it, But i du not want my pogram to be paused ny the delay()
ad far as i have found out its something about the sketch blink without delay, but i can not see what to change?
const int ledPin = 13;
int bottenpin = 3; //
int ledState = LOW;
long previousMillis = 0;
long interval = 2000;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(bottenpin, INPUT);
}
void loop(){
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > interval) {
previousMillis = currentMillis;
if (ledState == LOW)
ledState = HIGH;
else
ledState = LOW;
digitalWrite(ledPin, ledState);
}
}
Can you please edit the code so that the bottonpin 3 turns on the led and keeps it on for like 2 secounds?
Thanks..