Blinken ohne delay() mit 2 Taster und 2 LEDs
mehrfachzeiten, blink without delay
LED blink, no delay(), one line of code
BlinkwithoutDelay - Die Nachtwächtererklärung
Videos
digitalWrite(LEDPin,millis()%500>250);
It's quick, it's dirty, and it's probably the best thing I'll come up with this year.
Hello, I need a little bit of help.
The guides I've seen either have 1 led blinking or multiple at the same time which doesn't really help me, and I've seen no real solutions for a sequential blink without using delays...or none that make any sense to me.
I can't use delays because I need them to do one thing while waiting for an input then do something else. The functioning code I have right now is:
void blink1(){
digitalWrite(Led1, HIGH);
delay(250);
digitalWrite(Led1, LOW);
digitalWrite(Led2, HIGH);
delay(250);
digitalWrite(Led2, LOW);
digitalWrite(Led3, HIGH);
delay(250);
digitalWrite(Led3, LOW);
delay(500);
}
void blink2(){
digitalWrite(Led1, HIGH);
digitalWrite(Led2, HIGH);
digitalWrite(Led3, HIGH);
delay(250);
digitalWrite(Led1, LOW);
digitalWrite(Led2, LOW);
digitalWrite(Led3, LOW);
delay(250);
}
I have it setup like this because the eeprom has an initial value stored, In the loop it looks at the eeprom value and calls the specific blink. When there's an input it updates the eeprom value and then will call the other blink... had to use eeprom because I need it to save that state in the event of a poweroff. That's all working fine I just can't figure out how to make the LED's blink like this without using delays.
Thank you!