# LabVIEW

cancel
Showing results for
Search instead for
Did you mean:

Solved!
Go to solution

## How do I make LED turn ON and OFF based my numeric value input ? For instance, if I input 5, I would like LED to turn ON and OFF 5 times.

So If I input 2, I would like the LED to go ON and OFF 2 times. 3 > 3 times, and so on. I tried, but failed.

Can someone help?

See my attached code.

Message 1 of 12
(641 Views)

## Re: How do I make LED turn ON and OFF based my numeric value input ? For instance, if I input 5, I would like LED to turn ON and OFF 5 times.

When does the count get reset?  Is there supposed to be a button to start the blinking?

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 12
(623 Views)

## Re: How do I make LED turn ON and OFF based my numeric value input ? For instance, if I input 5, I would like LED to turn ON and OFF 5 times.

Initially, the LED will be OFF.  So let's say I input number "1", I should expect the LED to turn ON then OFF once. If I input 100, I should expect the LED to turn ON and OFF 100 times. So there is no start button to start blinking. My input is the trigger basically.

Feel free to suggest too. I'm open for suggestions.

Message 3 of 12
(614 Views)
Solution
Accepted by topic author GRCK5000

## Re: How do I make LED turn ON and OFF based my numeric value input ? For instance, if I input 5, I would like LED to turn ON and OFF 5 times.

This is what I came up with.  I used the Is Value Changed.vim to detect the input changing and perform the reset.

There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 4 of 12
(584 Views)

## Re: How do I make LED turn ON and OFF based my numeric value input ? For instance, if I input 5, I would like LED to turn ON and OFF 5 times.

Thanks crossrulz!!! It works as expected.

Message 5 of 12
(570 Views)
Solution
Accepted by topic author GRCK5000

## Re: How do I make LED turn ON and OFF based my numeric value input ? For instance, if I input 5, I would like LED to turn ON and OFF 5 times.

Here's how I would do it.

Message 6 of 12
(533 Views)

## Re: How do I make LED turn ON and OFF based my numeric value input ? For instance, if I input 5, I would like LED to turn ON and OFF 5 times.

Can't see paul's idea due to VI version, but here's mine.

Message 7 of 12
(496 Views)

Message 8 of 12
(448 Views)

## Re: How do I make LED turn ON and OFF based my numeric value input ? For instance, if I input 5, I would like LED to turn ON and OFF 5 times.

@GRCK5000 wrote:

Initially, the LED will be OFF.  So let's say I input number "1", I should expect the LED to turn ON then OFF once. If I input 100, I should expect the LED to turn ON and OFF 100 times. So there is no start button to start blinking. My input is the trigger basically.

Feel free to suggest too. I'm open for suggestions.

You need to be significantly more detailed in the requirements.

• What should be the blinking rate? (should the on time be the same as the off time during blinking?
• What should happen if the number is changed while it is still blinking from the previous input? SHould the control be disabled during blinking?
• If you enter 5 and it blinks five times and then you enter 10, should it do five additional blinks or 10? What if the new number is less that the previous value?
• Why do you have a pointless feedback node instead of doing the comparison before the case structure?
• etc.

Message 9 of 12
(403 Views)
Solution
Accepted by topic author GRCK5000

## Re: How do I make LED turn ON and OFF based my numeric value input ? For instance, if I input 5, I would like LED to turn ON and OFF 5 times.

I don't think you need any case structures, here's one possibility:

Message 10 of 12
(398 Views)