one button, multi LED control help...newb
I have a project i'm working on. I want one button to be able to toggle 3 lights. When button is pushed first time led 1 comes on, then on second push led 1 of then 2 on, then led 2 off led 3 on, then led 2 and 3 on, then back to 1.
I know how to toggle one led jusst need to understand how to go through al 3. If any one can provide some input or some sample codes it would greatly be appreciated.
Thanks
Trae
I know how to toggle one led jusst need to understand how to go through al 3. If any one can provide some input or some sample codes it would greatly be appreciated.
Thanks
Trae

Comments
Use either IF...THEN of SELECT...CASE statements to decide which LED to turn on based on the variables value.
When the value gets to 5, remember to set it to 0 again so that the sequence is repeated as you continue to press/release the button.
Your DATA table could look like:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
counter VAR Word counter = 0 DO IF (IN3 = 1) THEN counter = counter + 1 PAUSE 250 ENDIF SELECT counter CASE = 1 HIGH 15 CASE = 2 LOW 15 HIGH 14 CASE = 3 LOW 14 HIGH 13 CASE = 4 LOW 13 counter = 0 ENDSELECT LOOP-- Jeremy
Thanks for the example code Jeremy I had come up with something simular after I got the info from Andy.
Thanks Again
Trae