Showing results for 
Search instead for 
Did you mean: 

Boolean change when value matches



I'm trying to make it so that when the numerical value is between where I want it to be a boolean value is true then false. 

so for values of 0,400,600 +- 25. When the value is near 0 the boolean value should be true then false, then when the value is around 400 true then false, when it's around 600 true then false. but only once. I want the boolean value to be 1 when it's near that number, then move on to the other number. I have this so far, but I can't figure out a way to only have it be true once. Please help!


True then fanse.PNG

0 Kudos
Message 1 of 4

The for loop is running only one time.

Change it to 2 (number connected to N), it will run 2 times, then it will do your logic. (I wasn't able to understand why you want this way... but it does what you want).

0 Kudos
Message 2 of 4

When you changed N to 2 as suggested by LVninja, did you get what you expected?

0 Kudos
Message 3 of 4

With your description you could just to a permanent true/false switch and it'd fill the requirement ...

However, i assume you want to check through a list of values? Should it continue once it fails the test, or on the 2nd test, or when input changes?

For starters, your input should be an (3) arrays of values, add an outer for loop. The current loop should be a While, since you want to test until a specific requirement is fulfilled. I'd make the Value input on that loop a Shift register and compare it to previous value and instead of comparing with 0, it should check that the value is changed. If it fails, exit the While loop.

(It sounds like a silly test/setup, but i guess you're learning how functions work) 


G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
0 Kudos
Message 4 of 4