07-18-2019 10:43 AM
I am working on a program to control the movement of a linear actuator through analog voltage output signals. I have a DAQ chassis as well as a NI 9263 card to send signals. I found code online that controls the motion of the linear actuator through a slider where the full extension of the actuator occurs when the slider is at 10V and full retraction at -10V. I also have code that generates smooth, cyclic motion of the actuator based on various waveforms. I want to control the movement of the actuator with the slider first, and then press the 'compress' button on the front panel and send the actuator into its cyclic compression settings. I am trying to input the slider code into a case statement with the condition being that the 'compress' button is false. I can't seem to figure out how to use this case statement. Any help would be greatly appreciated! Sorry if this is fairly basic, I'm still very new to LabVIEW.
07-22-2019 04:26 PM
Hi @CWatty,
It sounds like what you need is actually an event structure. The reason you are seeing problems with your code is because case structures only evaluate the conditional case once and then move on. In contrast, event structures constantly monitor front panel objects for an event to occur (such as a button click) and then execute the code within.
You can read some more about this idea in our tutorials on Event-Driven Programming and State Machines.