Go Down

Topic: Hi, Simple question Blink without delay() (Read 456 times) previous topic - next topic

fenix8k

There is a way to blinnk a led without the delay() function?

i whant to blink a led every 1 min, but in the normal way i use something like this

Code: [Select]

digitalWrite(13, LOW);
delay(1000);
digitalWrite(13, HIGH);
delay(1000);


but i whant to blink and be able to push a button or something else but when the program is in the delay(); part the program are in "pause", so there is a way to blink a led without stop the program for the delay duration?

Like using PWM that is the same but alot faster xD

PaulS

Quote
There is a way to blinnk a led without the delay() function?

Of course there is. There is even an example called, not unsurprisingly, Blink Without Delay.

bperrybap

Or instead of having to deal with all the timer tick polling, look at some of the timer libraries.
Some use interrupts, some depend on getting updates in loop()
--- bill

http://arduino.cc/playground/Code/Timer
http://arduino.cc/playground/Main/MsTimer2
http://arduino.cc/playground/Main/FlexiTimer2

Nick Gammon


There is a way to blinnk a led without the delay() function?


http://www.gammon.com.au/blink
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

fenix8k

Thx alot that is helpfull, when i go home i try these

Go Up