What would be the simplest way to turn an LED on and off at a rate that is controlled by a knob or something. Meaning that I could either leave it turned off or make it pulse every three seconds, five seconds, etc. ?
Solved! Go to Solution.
Write a True, wait, Write a False, wait, repeat. The knob would be wired to the wait. Add a comparison of the knob value and skip the write True if the values is less than some value. Do not do an equal comparison unless the knob is an integer data type.
If this is an actual LED, you would be using a DAQmx Write. If not, you can use a local variable of the indicator but you will get bonus points if you don't and instead use a state machine.
The vi you made was able to accomplish what I wanted to do. Thank you.
Now I tried to make 2 controllable LEDs in the same loop by just copying the same code for another LED and CONTROL. What that does is they both share the same timing no matter what I set them both to. Any help on how to do the same exact thing you showed me before but with 2 LEDS in the same loop would be appreciated. I was thinking it had something to do with the wait function or the shift registers? Should I make another loop altogether?
If both LEDs will come on and off together, just create another LED and wire it in parallel to the existing one. If the LEDs are to be separated (one could be on while the other could be off), create another shift register and duplicate the code. As long as the timing is the same, you can use just one loop for both LEDs. Instead of me wiring it for you, try it yourself. That is the only way you will learn.
Thanks for the reply, just asking for ideas.
As to the timing, I want them in the same loop in order to poll for the control value at the same time but not necessarily for the lights to turn on at the same time or for them to share the same pulse time. That would be completely up to the user.
I will continue to work on it. I appreciate your replies.