How do I cycle through 3 LED's with one button ?
Moderators: adafruit_support_bill, adafruit

How do I cycle through 3 LED's with one button ?

by Merlin_83 on Wed Jul 17, 2013 2:32 pm

Hi,

I have this https://www.sparkfun.com/products/10111 and have had success with getting it to light up (all three). But I do use a single push button, and cycle through each LED ? And then after each one has illuminated, the last button push would light all of them up ? I have switched to purchasing my goods through Adafruit since I get stuff much faster, so although purchased elsewhere - I am hoping for assistance on this device here at Adafruit. I have tried a couple times using existing code, but am unable to 'cycle' through them.

Could someone please provide some guidance ?

Thank You,
Merlin
Merlin_83
 
Posts: 5
Joined: Fri Jul 12, 2013 1:04 pm

Re: How do I cycle through 3 LED's with one button ?

by franklin97355 on Wed Jul 17, 2013 3:53 pm

You could set up a state machine so each button press will increment a counter and then light that led. Attach the code are you using and explain what is not working.
User avatar
franklin97355
 
Posts: 5879
Joined: Mon Apr 21, 2008 2:33 pm