I modified this code from one of the example in the forum. I forgot which thread. Original file name is "loop speed control.vi"
I want to measure pressure and compare with target pressure. Once the pressure reading is higher than the target pressure, I hold the output high for 5 seconds and turn it to low.
When It goes back to low, I want the to exit the loop or when I pressed the stop button. I do not how to do this one. Please help.
Solved! Go to Solution.
Yeah, you definately want a state machine. This probably would become very simple when you break down the states properly.
Hi Gregoryj and Crossruiz,
Thank you it really helps. The logic is cleaner than my previous.
There is this thing that I need to fix.
Motor is used to increase pressure
Valve is to dump the pressure.
I used delay to hold thre pressure once it reach the target pressure. (TRUE condition).
Pressure readings fluctuate.
The problem that I have here is that once the pressure reading is higher than the target. I do not want the code to return back to "False" (pressure reading is lower than target).
I can't view your VI (I'm using LV 2014). Please see my attachment for an example. See what happens when you make the value of numeric >= 1. Turn on the highlight execution if it does not make sense.