LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use waveform to control LED?

Hello,

I am new to LabVIEW. I have had some success with blinking a LED and controlling LED based on cursor position.

However, I now want to control LED based on PWM. I know there are some PWM examples to control LED but they are not what I am looking for.

 

I would like to control LED based on the signal I have generated (please see the attached image). While the signal is high (at 5 in this case), the LED should turn on and while is signal is low (0 in this case), the LED should turn off.

 

I was able to obtain a 1D boolean array from the waveform but the LED accepts only Boolean but not an array. I am unable to understand this because I imagined that with an array, I will be able to turn on and off based on the signal. I intend to control the LED using an Arduino Uno.

 

Can someone please help?

 

Best regards,

Shashank

 

P.S: Attached sketch does not contain the Arduino part.

0 Kudos
Message 1 of 15
(5,618 Views)

If you are sure that your values will be 0 or 5 then use select switch if the value is 0 then provide FALSE to LED Indicator else TRUE to LED Indicator

----------------------------------------------------------------------------------------------------------------
Palanivel Thiruvenkadam | பழனிவேல் திருவெங்கடம்
LabVIEW™ Champion |Certified LabVIEW™ Architect |Certified TestStand Developer

Kidlin's Law -If you can write the problem down clearly then the matter is half solved.
-----------------------------------------------------------------------------------------------------------------
0 Kudos
Message 2 of 15
(5,598 Views)

you're almost there.. pass your Boolean array through for loop and attach to boolean

bp
Message 3 of 15
(5,587 Views)

Dear Mr. Thiruvenkadam,

 

Thank you for your reply. I had tried to connect the waveform to a switch, but that ends up in an error: "You have connected two terminals of different types".

0 Kudos
Message 4 of 15
(5,582 Views)

@bharathp10 wrote:

you're almost there.. pass your Boolean array through for loop and attach to boolean


Dear Bharathp10,

 

do you mean something like the attached image? It still doesn't work.

0 Kudos
Message 5 of 15
(5,576 Views)

Hi shasv,

 

a simple example how you could handle arrays:

check.png

 

Dear Bharathp10,

do you mean something like the attached image? It still doesn't work.

What's the point in connecting a waveform to the iteration count input of the FOR loop?

What's the point in analyzing the iteration counter to driver the LED - when you want to output this waveform???

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 15
(5,573 Views)

Dear GerdW,

 

This is exactly what I was looking for. Please excuse my mistake with FOR loop. I do not have any background in programming.

 

Thank you very much.

 

Best,

Shashank

0 Kudos
Message 7 of 15
(5,565 Views)

@GerdW wrote:

Hi shasv,

 

a simple example how you could handle arrays:

check.png

 

 


Dear GerdW,

 

I noticed that the LED blinking is erratic and is not according to the waveform. For example, at1 Hz and 50% duty cycle, the LED just keeps blinking with short moments where it is off. It is the same if I change to 20% duty cycle. 

 

Do you observe the same behavior? 

0 Kudos
Message 8 of 15
(5,550 Views)

Hi shasv,

 

as I wrote, it's a simple example!

 

There is no timing at all in the loop. When you need the timing in the loop, you need to program it (in the loop)…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 9 of 15
(5,533 Views)

Hi GerdW,

 

Yes, I realized this through the 'highlight execution'. The LED actually follows the waveform, just that the timing is weird. I am trying to learn more about it.

Thank you very much for your responses.

 

Best regards,

Shashank

0 Kudos
Message 10 of 15
(5,522 Views)