LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LabView problem with while loops.

Solved!
Go to solution

Thank you all for your reply, 

 

I convert boolean to number for a reason.  Im trying to 'simulate' the sensors that i am gonna actually use. I have two sensors that work like switches when water flow through them so imagine that in a big bottle there is one sensor down and one sensor up   check for the photo.

prob.png

  So boolean is a switch. But when i  connect them to mydaq i take data from AnalogInput:  negative volt when the switch is off and positive volt when the switch is on . So i am gonna use a pump to control the water. When the water is below down switch the pump must open... and stop only until the upper sensor is on (so both sensors are on) ->And here is my actually problem . I want to reopen it again when water is below down switch and do that loop again and again. 

 

So when you run this programm you have to push mechanically the boolean switches like if the water was going up and down . Thats why there is NOT a state where  the upper switch on and the down switch off. And thats the reason why i am using the delays so i can catch up and ' mechanically switch on and off the boolean switches'

 

I want also to be informed through the programm in which state the water is : state1-> below down switch. State2-> In between the two swithes. State3-?> up from the upper switch( so both are on). Thats the reason why i have states.

0 Kudos
Message 11 of 13
(614 Views)
Solution
Accepted by topic author KatsanikJr

You do have 2 states.

1.  Pump is on and thus water level is rising.

2.  Pump is off and thus water level is dropping.

 

(Did I read that correctly that the pump is filling the bag?)

 

So you keep the state of the pump in a shift register as a boolean.

 

1.  If lower switch is off, put a True into the boolean shift register.

2.  If the lower switch is on and upper switch is off, do nothing but carry the current value of the shift register true.

3.  If the upper switch is on, but a False into the boolean shift register.

Message 12 of 13
(607 Views)

Thanks for the reply. It seemed really really helpful. At last i solved it

 

0 Kudos
Message 13 of 13
(597 Views)