Page 1 of 1

Selectable LED Pattern

Posted: Thu Oct 13, 2011 6:05 am
by driftlogic
Hi All,

I'm able to create a simple LED flashing pattern in the program. How could I utilize a switchbank to choose some predefined flashing patterns? I assume I have to utilize the If (Decision).

Thanks

EDIT: okay i figured it out by using a slide switch and using a component macro to read the value (0 or 1) of the chip to follow a certain decision. Is there a way though to be able to select more than 2 patterns?

Re: Selectable LED Pattern

Posted: Thu Oct 13, 2011 11:25 am
by Benj
Hello,

The switch icon will let you select more then two outcomes from a variable's value. Simply use an input icon to read the value from the switches and then use the switch icon to decide what to do based on the value from the input.

Re: Selectable LED Pattern

Posted: Thu Oct 13, 2011 5:23 pm
by driftlogic
I can see from a single switch how to read if its a 0 or a 1 and to have an action for either case. With a switch bank im not sure how it works. Should each pin be hooked up to the same pin? Different Pins? If they are to different pins how do I read the value of the switch to a particular pin (since they are part of the same switchbank). It they are to the same pin, say i have two switches on, is that a readstate of 2?

Re: Selectable LED Pattern

Posted: Thu Oct 13, 2011 6:20 pm
by driftlogic
Nevermind I figured it out. I just used the input of a switch pin to set a variable (int). And then could decide what to do