LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LED on time limit

I am attempting to make a sun simulator. A temperature input will be used to control the time the sun rises and sets. i would like an LED to be on for a certain amount of time during the sunrise and sunset times. i would also like the daytime LED to be on between the sunrise and sunset time and all of the LEDs to be off between the sunset and sunrise rime (night). I am having trouble turning the LED on and off at specific times.

 

Thank You

0 Kudos
Message 1 of 3
(1,867 Views)

First problem is this VI only runs once.  There is no loop to keep this running.

 

Please don't tell me that you are trying to use the Run Continuously button.

0 Kudos
Message 2 of 3
(1,857 Views)

All your VI does is run through the code once, taking 24 seconds (24000ms, the upper flat sequence is the time-limiting step, the rest of the code basically executes immediately). Your VI has no idea about the current time, just elapsed differences that are always the same as programmed. "Time(s)" is actually in milliseconds and will always be 24000 within jitter.

 

Start by creating a proper state machine with a toplevel while loop that polls the current time and temperature at regular intervals and acts accordingly. Also learn about numeric representations (coercion dots!), abuse of local variables (none are needed here), and other proper coding practices. There are plenty of beginner tutorials.

0 Kudos
Message 3 of 3
(1,855 Views)