LabVIEW Interface for Arduino Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Control duration of light on and light off states in blinking LED

Could someone please explain how I can use labview to independently control the time an LED (which is connected to an arduino) is in the "light on" (ON) and "light off" (OFF) states during a flickering sequence?  I am trying to use Labview to communicate with an arduino which would then control  the ON and OFF durations of a blinking LED. 

I am essentially trying to program labview to perform the same functions as those in the attached arduino code.  So, I'm looking for a way to make labveiw perform the same function as the delay(10000) and delay(20) commands in the arduino code (in order to control the time the LED is on and the time it is off). 

I have already determined how to control the LED brightness through PWM from Labview, so do not need suggestions for that portion of the code.

Thanks in advance for your help!

0 Kudos
Message 1 of 3
(4,605 Views)

Jkanwl, You must have loop in your Labview code, right? Without giving this much (or enough!) thought, I would suggest you to use a sequence with in your general loop. Note, that one can not simply put a sequence box around part of a code in Labview. It would probably take some rearrangement(s) of your code.  Would be interested to see what others would suggest. In any case, if you attach a VI that you are working on, it would be much easier to anyone to help. Regards, Barddya

0 Kudos
Message 2 of 3
(3,391 Views)

The code that you posted essentially has the LED on all the time (because it only turns off for 20ms which is seems like it would be imperceivable to me).

Timing accuracy via the LabVIEW-Arduino communication is not really well controllable depending on the timescale that is being considered.

In general, one good method you would want to handle 10 second timing is to use the millisecond clock and store the the time whe you want a period to start.  Then, you would check that stored time against the current millisecond clock and see if your time has elapsed.  If yes, then execute the code that you need to execute at the end of that period.

The 20 ms time may or may not be able to be achieved via the LabVIEW interface with Arduino due to the time required for communication.

0 Kudos
Message 3 of 3
(3,391 Views)