one button, multi LED control help...newb
T.Ellis
Posts: 2
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
-- Jeremy
Thanks for the example code Jeremy I had come up with something simular after I got the info from Andy.
Thanks Again
Trae