From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

How to use a slider to turn on and off lights

Solved!
Go to solution

Hi guys. i am fairly familiar with Labview now but cant seen to get my head around this problem. i have a slider which is numbered from 1 to 10. below the slider i inserted 10 LED lights. my aim sis to use the slider to turn on and off the lights. for an exmaple, when i set the slider to one, the light on the far left should go on. when i set the slider to 2, the first light should go on and the second light next to it should go on, and the pattern continues. i thought of using the number to array boolean but it didnt seem to do the trick. could you please help me out. i have attached the basic layout of how i wanted the objects to be arranged

 

kind regards

joe

0 Kudos
Message 1 of 11
(3,164 Views)
Solution
Accepted by topic author Jus Joe

Maybe something like this?

0 Kudos
Message 2 of 11
(3,148 Views)

Genius! totally what i was looking for. thats a lot

0 Kudos
Message 3 of 11
(3,143 Views)

Ok i followed your example and is definatley a step foward. for the bast hr and a half i have battling to figure out why i cant get the program to work with negative numbers. i have resized the slides scale to -1 and 1 with 0 inbetween. -1 should turn on the red light on the left, 1 should turn on the green light on the left and 0 is neutral, all lights are off. i have got the 0 and 1 working as expected but cant get the -1 to respond :s. any tips again please?

0 Kudos
Message 4 of 11
(3,129 Views)

Ok i think i have done it the right way :D. let me know what you think

0 Kudos
Message 5 of 11
(3,125 Views)

Overly complicated.

 

0 Kudos
Message 6 of 11
(3,116 Views)

If you still want multiple LEDs on each side, here's one possibility... (For only two LEDs, use Dennis's solution.)

0 Kudos
Message 7 of 11
(3,107 Views)

wow! simplicity at its best! thats really straight forward to understand. i think you are right about making complicated circuits. the reason why i had asked to know how to do this was because i wanted to learn how to control motor directions using a slider. so after i thought i had got the easiest way of giving out 2 different outputs using a slider, i replaced the lights with switches that changed the direction of the motor. i successfully did this for the first motor and it rotated fairly well, but wanted to control 4 in total. so i simply copied and pasted the code and re-asigned the switches to different motors. when i did this, the results did work BUT the motors went very very slow. the movement was not steady and kept skipping. i think this its due to the coding being overly complicated thefore causing a serious lag. if you could please have a look

 

kind regards

 

joe

0 Kudos
Message 8 of 11
(3,067 Views)

Why do you coninue to post if you do not take the given advice? Why should anyone answer when the advice is ignored?

0 Kudos
Message 9 of 11
(3,063 Views)

i apologise. i didnt mean to seem like i was ignoring feedback. i just wanted to show what i had done so far. im working on the code now as we speak using the picture provided from the previous post.

 

kind regards

0 Kudos
Message 10 of 11
(3,060 Views)