From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3 LEDs with button

Hello, I need help with LabVIEW. There is a exercise where you need to make 3 LEDs with 3 buttons. In with 1 button will light 1 and 3 LED, Second button will light 2 LED and turning off 3. (1 switch is turned on). And the third button makes all the LEDs off.

There is a picture with example.Screenshot_1.png

0 Kudos
Message 1 of 10
(2,953 Views)

Problem is not clear.

 

Do we have 8 different switch states and a truth table for the three LEDs in each state, or does the result depend on the order of operations as you describe. Since the switches can be operated in many other orders, you need to describe the desired output for all possibilities.

 

What have you tried so far? Where did you get stuck?

0 Kudos
Message 2 of 10
(2,948 Views)

Hi Andre,

 

to add to Christians request: you seem to use switching buttons (in contrast to latching behaviour)  so there are another 8 states you need to define!

Is the action shown in the images only valid when switching the button to TRUE? What happens when switching to FALSE?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 10
(2,937 Views)

Well, I stopped at the start because I am newbie in the LabVIEW. I started by connecting all the switches with LEDs but it didn't go well. So at this moment I am stuck

0 Kudos
Message 4 of 10
(2,931 Views)
Using the NI Labview software package, write a control program using LEDs and switches. When switch 1 is switched on, LED1 and LED3 light up. When switch 2 is switched on, LED2 lights up and LED3 goes out (switch 1 is not switched off before). When switch 3 is switched on, LED1, LED2 and LED3 go out (previously switch 1 switch 2 is not off)

I've got this task. And picture attached with it

0 Kudos
Message 5 of 10
(2,920 Views)

(Please don not use code tags for text here. It is annoying to scroll.!)

 

Can you show us what you tried and where you got stuck? Did you place the switches and LEDs on the front panel? Dod you place a while loop on the diagram yet?

 

Who gave you this task and why would he give it to you since you don't seem to know LabVIEW? Is this part of a course? How many lessons did you have so far? Did you try some of the tutorials? 

 

(I would use an array of switches and an array of three LEDs, covert the switch array into a number and use it to index into a 2D boolean lookup table)

0 Kudos
Message 6 of 10
(2,911 Views)

Hi Andre,

 


@AndreLT wrote:

Second button will light 2 LED and turning off 3. (1 switch is turned on).


Well, I would use an array for the LEDs, but still scalar buttons:

I use "value change" events for each button, in the image the event for button2 is shown.

I guess you can figure out the other states (button1, button3, and stop)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 10
(2,894 Views)

This is where I got. 3 Switch isn't attached to anyone.

 

LAB.pngLed1.pngLEd2.pngLEd3.png

 

Well I am studying at the college so it is part of a course, there where about 8 lessons but they were difficult to understand because of remote study. So thanks to youtube I understood some basic knowledge.

0 Kudos
Message 8 of 10
(2,891 Views)

Hi Andre,

 


@AndreLT wrote:

So thanks to youtube I understood some basic knowledge.


You have two days left to take the self-paced courses directly at www.ni.com - they are free until end of April!

(Why do people look for tutorials at Youtube when there is a huge amount of training resources offered at the manufacturer website?)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 10
(2,888 Views)

@GerdW wrote:.
Well, I would use an array for the LEDs, but still scalar buttons:

 

Well, if the container is transparent, you would not really know the difference 😄

 

altenbach_0-1588143765750.png

 

Yes, a 4 column LUT would be sufficient here, but I made it big enough to handle all possible combinations if that's needed in the future. 😉

 

At this stage or learning, I would stay away from event structure.

 

And NO, AndreLT, Do NOT try to copy that code. it's probably not what your teacher had in mind. Still try to understand it as a separate exercise. 😄

 

0 Kudos
Message 10 of 10
(2,876 Views)