LabVIEW Student Community

Highlighted

Hi, I need help: blinking LEDs

Hello everyone,

I am new at using Labview and, although I spent the last 3 weeks reading the manual  and playing with functions, I still can't find a way to

generate a square/pulse function that turn on an LED when high, and turns it off when low.

I was able to make a circuit with a blinking LED but it seems to be not in sync with my function. Please help me build this circuit. graph.jpg

0 Kudos
Message 1 of 8
(7,669 Views)
7 REPLIES 7

Re: Hi, I need help: blinking LEDs

Try this, your boolean was probably not working while offset is not zero.

example.PNG

Message 2 of 8
(3,227 Views)

Re: Hi, I need help: blinking LEDs

Hi Njohuri,

Thank you for your reply. I have a little tough time replicating the given code as I am still pretty much a beginner in Labview.

Could you send me the vi file? It might be easier for me this way.

Thank you so much

0 Kudos
Message 3 of 8
(3,227 Views)

Re: Hi, I need help: blinking LEDs

The approach using a simulated square wave has potentially to many pitfalls.

a) You have two timer, one through the frequency settings of the square wave generator and one for the loop

b) If you convert the dynamic data type (blue wire) from the square wave into a double you only use the last data point.

Especially point b) can cause an issues if you configured the square wave in a way that Frequency (Hz) is an even divider of the Timing value Samples per second (Hz) or Reset Signal is not set to Use continuous generation. Since a square wave is a symmetric pattern the last data point (the one used when converting to DBL) is always the same. If you place the express block for the first time and select square wave you will see that the Frequency is set to 10.1 Hz and the preview shows a "moving" square wave. Set the frequency to 10Hz or change reset signal to Reset phase, seed, and Time stamps and you will see that the wave appears to be standing still since start and end point are always the same.

The easy way to make a Boolean LED blink with a certain clock is to use a shift register and a timer.

LED.png

Regards
Ingo Foldvari
Area Sales Manager - US West Academic
National Instruments
Message 4 of 8
(3,227 Views)

Re: Hi, I need help: blinking LEDs

I hope I've upload it right. Ingo Foldvari is right, the way he did it it is better (for the case of a blinking LED). I just tryed to correct your vi. It depends on what you wan't to do. In the correction that I've made you don't need the timer (control miliseconds to wait and the delay).

I've not uploaded a vi before therefor I am not sure if it will work and if it it the right way.

ex.vi

PS: This might also help you, (a blinking led on arm) https://www.youtube.com/watch?v=8ksZa0Z-ay4

Message was edited by: Njohuri

0 Kudos
Message 5 of 8
(3,227 Views)

Re: Hi, I need help: blinking LEDs

Hi Ingo,

Thank you for your reply.  Indeed this is a very simple way to make an LED blink with a square wave.

The b) that you mentioned is indeed what I had noticed but I just couldn't find a way to deal with it.

I am glad I can now.

Njohuri's method has the advantage of also giving me a pulse system or should I say the possibility of

changing the duty cycle %. How would you incorporate that in your system, Ingo Foldvari?

0 Kudos
Message 6 of 8
(3,227 Views)

Re: Hi, I need help: blinking LEDs

Hi Njohuri,

Yes, I got your file. It was properly uploaded. I am studying it right now. Thank you

0 Kudos
Message 7 of 8
(3,227 Views)

Re: Hi, I need help: blinking LEDs

What can i do if i have an arduino code. Like this i want to implement on Labview

0 Kudos
Message 8 of 8
(188 Views)
Reply
This is an open group. Sign in and click the "Join Group" button to become a group member and start posting.