LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to turn on the led using number?

Hello,

is there anyone can help me with this problem? I having difficulties to turn on the LED after the comparison i made. 

This is the situation, i input a value and using conditional method to compare the input then after the comparison the output would be just come out one or zero. Therefore, if the output is one then the  LED will light on but zero will result in turning off the LED. 

Here is situation: How to convert the output number to the Boolean so that it will turn on the LED?

Untitled.jpg

 

Best Regards,

Nicky

0 Kudos
Message 1 of 14
(6,441 Views)
Use the "equal to zero?" function in the comparisons palette.
LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 2 of 14
(6,440 Views)
Oop.  Actually "NOT equal to zero" is the correct function.
LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 3 of 14
(6,438 Views)

Hi,

The comparison have been made. Just that, I want to convert the output number to Boolean so that it will light up the LED. If i just connect the output to the Boolean, there is an error which stated that the number is no compatible to boolean true or false. I have used Number to Boolean but thre is no use..

0 Kudos
Message 4 of 14
(6,437 Views)

Hi Peh,

 

any comparison function will give you a boolean output. Why not use one of them?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 14
(6,427 Views)

Not Equal to Zero will give you a boolean.

 

 

Message Edited by Ray.R on 03-09-2010 10:41 AM
Message Edited by Ray.R on 03-09-2010 10:41 AM
0 Kudos
Message 6 of 14
(6,425 Views)
see pic
LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 7 of 14
(6,424 Views)

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?

0 Kudos
Message 8 of 14
(6,412 Views)

Why are you using a formula node in the first place? Let me guess: you're a C programmer trying to do LabVIEW. Am I right? Gotta be, especially given the line if (x || y == 1). Booleans in LabVIEW are their own datatype, unlike Booleans in C, which are just integers. Forget the formula node. All you need is to implement the True condition of your test, which is if (x > 0 OR y == 1) using LabVIEW Boolean operators and Comparison functions.

 

To learn more about LabVIEW it is recommended that you go through the tutorial(s) and look over the material in the NI Developer Zone's Learning Center which provides links to other materials and other tutorials. You can also take the online courses for free.

 

 

P.S. In the future please crop your images.

Message Edited by smercurio_fc on 03-09-2010 09:45 AM
0 Kudos
Message 9 of 14
(6,404 Views)

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.

 

 

Message Edited by Ray.R on 03-09-2010 10:47 AM
0 Kudos
Message 10 of 14
(6,397 Views)