Go Down

Topic: LED-Blinker (Read 791 times) previous topic - next topic

Applefreak

Hi,
i'd like to tell you my Plan i would like to do. I've bought an arduino UNO to build an bike blinker with two buttons, if i push the first button the left LED should blink as long as i push the button again. The same with button two and LED two.

Thank you for your help already now.

[Sorry for my English, i'm German;)]

fungus


Hi,
i'd like to tell you my Plan i would like to do. I've bought an arduino UNO to build an bike blinker with two buttons, if i push the first button the left LED should blink as long as i push the button again. The same with button two and LED two.

Thank you for your help already now.


What have you done so far?

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

tuxduino

Start by studying the "blink without delay" example. Expand it to make two leds blink. The two leds should blink independently from each other. Also, you should be able to change their blink times independently from each other.
All of this without touching a pushbutton.

Once you understand the non-blocking delay mechanics, you can start polling the two buttons with the same technique. You need two state variables for each led: one to tell you if the led is currently on or off, the other to tell you if it's blinking or not. When you detect a change in the button state (from not pressed to pressed), you switch the "is blinking" state variable of the corresponding led.

Hmm... too much meat probably :P I hope it makes at least some sens to you :)

CarlW

This is in English too...

Look at Sparkfun Inventors kit.

This should be a link to the booklet that comes with the kit.
http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Dev/Arduino/Boards/ARDX-EG-SPAR-WEB-REV10.pdf

Look at pages 10 and 22 of the pdf document. (CIRC-01 Blinking LED and CIRC-07 Button Pressing - Pushbuttons)






Go Up