03-09-2010 09:47 AM
Dennis Knutson wrote:You have not used the not equal to zero function. Place it on your block diagram and connect it to the output of the formula node. You should also be working with ints if you are going to do equal/not equal comparisons.
p.s. The use of the formula node seems silly. Why don't you just do it all in LabVIEW?
This is very basic LabVIEW programming. Have you taken the free tutorials?
And here I was too polite to say anything.
I used to see this type of thing a lot when I worked with guys proficient with MathCad, etc. They loved that formula node.
03-09-2010 09:51 AM
03-09-2010 10:51 AM
Ray.R wrote:I couldn't edit this drawing fast enough to beat Dennis & smercurio's posts... 😉
But they are correct..
If the content of the formula node is what you want to do, then what I posted earlier should do the trick. They do the same thing. If the ring control selection is not zero, it will light up the boolean indicator.
That would take care of the "x" part of the OR, but not the other half of the check y == 1, which I'm not sure of its purpose. True, there's a constant of zero connected to the formula node input, but it could be a control. Thus, if y == 1 you still want the Boolean to light up even if the ring's value is zero.
03-09-2010 11:46 AM - edited 03-09-2010 11:50 AM
Well..
The code DID have y hardcoded to 0. 😉
However, the appropriate code should look for equality to 1 and not zero. After all, the ring control could have values other than 0 & 1, and it should only turn on the LED if the ring control gets a value of 1 (or, in the new example, if y is a control).
So, if y was a control (or a constant), the more appropriate code would be below. It also accounts for y being a negative number.