05-28-2018 12:14 PM
Hello,
I am new with LabVIEW and need some help with two subtasks.
"Light emitting diods (LEDs) can only be used within a very limited range of voltages. Below this range the diode will not work at all, above the voltage, the diod will burn. So its almost a binary state: LED on or LED off. But if you want to have a dimmable LED, you have to run the LED with a PWM. PWM stands for pulse-width-modulation. You switch the LED on and off for a very short periods. Your eye is not fast enough to follow and will see a mean value. Our PWM will be much slower, so that we can see the change between on and off."
The basic programm should have the following features:
I have come up with two solutions but they are both wrong. The solution should be something in between my two solutions but I have no idea how to proceed.
Grateful for all help I can get!
05-28-2018 12:37 PM
Hi.
Are you using some NI hardware or custom Hardware or on what do you want to run the PWM?
I can not open your files as I am using an older version of labVIEW, Just curious to know
05-28-2018 01:33 PM - edited 05-28-2018 01:41 PM
I took a quick look at your VIs - the first one is probably pretty close to what you need.
Let me ask a couple of questions/make a couple of comments that should hint you in the right direction:
It also says you need a button to activate the PWM. In that case, you might consider having a case structure around everything inside your While loop, and setting the button to "Switch when clicked/released" mechanical action (rather than "Toggle when ..."). Obviously, make sure the button is also inside the loop (but it looks like you'd have known that already!)
Edit: Notes for second task:
05-28-2018 01:34 PM
It is a school assignment and so far it is only a theoretical question to be solved with the software, but eventually it will be used on NI hardware
05-29-2018 04:03 AM
I need two input values one for the period length and one for the percentage of the period length while the led is on.
So when the period length is 1s and 20% on then the led is 800ms off an 200ms on
But i don't know how to do this
05-29-2018 07:55 AM
Ok, so as I asked before:
06-05-2018 11:09 AM
So this is what I've come up with.
The only problem now is why the boolean is on while it has a false constant and why it is off while it has a true constant?
It should be the other way around.
06-05-2018 12:28 PM
You have to understand the idea of dataflow, that data will only flow out of a structure and on to its destination once that structure is done executing. Try turning on "Highlight Execution" (the lightbulb icon in the toolbar) to see how the data moves. You have your Wait functions inside of a Case selector, so as long as the wait function is running (waiting the commanded time) the Case structure will not be complete yet. Only once the Wait finishes waiting and the Case is done executing, can the True or False constant finally pass out of the Case and into the LED indicator. So basically, you're waiting the desired "on" time, and then turning the LED on, or waiting the desired "off" time, and then turning the LED off.
06-06-2018 04:41 AM
What arteitle said is what you should check - as they mentioned, your Wait function is inside the Case structure, so you're waiting before you 'release' the value of the boolean to the indicator. If you place the Wait outside of the case structure, then your Wait will occur at the same time the boolean indicator receives the new value, which might be more what you expect!
Also, now that you've sorted out the calculations of time (although it appears as though the % is % time Off, is that what you wanted?) take a look at the Select node I mentioned. This would allow you to remove the Case Structure entirely 🙂
02-25-2020 07:30 AM
i have the same task, can u help me with that if you are done