ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

A simple question about LED

It could be a simple problem but I couldn't work it out. Please check my attached code.
My purpose is: when click the 'run' button, the LED is OFF and after all 1000 random numbers are generated, LED is ON
Thanks for your help.
0 Kudos
Message 1 of 9
(4,335 Views)
Hello

There are many ways for that.
See attached you vi modified.
Cheers
Alipio
---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
0 Kudos
Message 2 of 9
(4,327 Views)
Thank you for your modification. I changed a little bit and it is almost what I want.
Only one thing left: after I run the program and got 1000 data, I want the LED keep ON, then I click 'run' again and LED is OFF. After I got all 1000 data, LEC is ON again.
Right now, after I click RUN, the LED just blinks and gone. I want LED keep ON before I click 'RUN' again.\\
Thanks.
0 Kudos
Message 3 of 9
(4,321 Views)
Hi
Now the led keeps on until next run and the array keeps its values, too.

Cheers
Alipio
---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
0 Kudos
Message 4 of 9
(4,304 Views)
Sorry forgot the vi
---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
0 Kudos
Message 5 of 9
(4,303 Views)
Hi, alipio , thanks for your reply.
In the attached picture, where does the part (highlight with red circle) come from? I can't figure out how to get it.
It should be a easy question but I just dont' know how. Thanks.
0 Kudos
Message 6 of 9
(4,279 Views)
If your on the front panel, right click the boolian indicator and choose "create>>local variable"
0 Kudos
Message 7 of 9
(4,271 Views)
it is a boolean constant (FALSE) wired to a local variable.
If you ricgtclick on any control/indicator and go to crate, you can create local variables. You can read and write then as if you read/write value in terminals. They are much like C local variables.
Search for doc in this web. there are a lot about locals and globals.

In this case, I used it to make the LED false before generating numbers.

Cheers
Alipio
---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
0 Kudos
Message 8 of 9
(4,269 Views)
Here's a different way to do it which I believe gives the operation you desire. It is a simple state machine structure which avoids the use of local variables.
0 Kudos
Message 9 of 9
(4,244 Views)