01-19-2023 06:30 PM
@GRCK5000 wrote:I think the problem is with my wording. 😔
Then draw a 40second timeline and four traces, one line for each led that should be on at any given time.
01-19-2023 06:34 PM
I am sorry. 1 complete cycle should 10 seconds, not 40 seconds. Then the same thing repeats again. So 1 cycle > 10 seconds, 2 cycles > 20 seconds, 3 cycles > 30 seconds and so on.
01-19-2023 06:37 PM
So shorten the times accordingly.
01-19-2023 06:52 PM - edited 01-19-2023 06:53 PM
I changed the off time to 2s as shown below. I get exactly what I want. Each led is being OFF for 9 seconds in 1 complete cycle which is 10 seconds, but here the problem I've been having instead of having a control with 2 seconds there, I would like to have 9 seconds meaning each led will have to be off for 9 seconds for 1 complete cycle of 10 seconds.
Something similar to this drawing:
01-19-2023 06:59 PM - edited 01-19-2023 07:08 PM
So do the math on the off time based on 9s in the control and the number of LEDs, "on" time, etc. before building the array. The rest can remain.
01-19-2023 08:07 PM
@GRCK5000 wrote:
I changed the off time to 2s as shown below. I get exactly what I want. Each led is being OFF for 9 seconds in 1 complete cycle which is 10 seconds, but here the problem I've been having instead of having a control with 2 seconds there, I would like to have 9 seconds meaning each led will have to be off for 9 seconds for 1 complete cycle of 10 seconds.
Something similar to this drawing:
So, the Duty cycle and Cycle time remain constant, just the phase of your pulse varies. Then, you need to have a control to specify the initial delay (0-9sec) for a 1sec pulse in a 10sec cycle time.
The question becomes, how do you know the start of a cycle? because in all the cases, the time between the pulses is a constant 9sec.
01-19-2023 08:09 PM - edited 01-19-2023 08:12 PM
I just found the solution by doing 2nd grade math.
Front panel
Now I can breathe. Yes!!!!
01-20-2023 09:59 AM - edited 01-20-2023 10:12 AM
So you said that later you want to expand it to more LEDs. Does that mean that later more than one LED is lit?
I don't think you need to do any math, you simply need to adjust the logic and redefine "one cycle".
It is a really bad idea to add random constants to the diagram. You need to do the math based on known existing values (off time, on time, # of LEDs, etc.) so you can easily change the timing (e.g. set the on time to 2s or off time to 11s) without doing second grade math all over again.
Again, please attach your latest VI. Please set embedded images to "large"!
01-20-2023 10:42 AM
Wow! So much effort just to blink a light on and off. Such inappropriate use of the High Resolution Timer. But you are very skillful in tricking well-intentioned LabVIEW developers to waste their time with your behavior ...
This blinks one LED according to the On and Off times set on the Front Panel, which can be changed as it runs. It is so simple, uses no math (which is even simpler than "Simple math"), and can be explained to someone with no computing experience once you explain the graphical elements. [In case you haven't guessed, the Stop button is in the False case, wired to the While Loop's Stop control to get it to stop at the end of the Off time].
Are you actually trying to make a "Marquee" light, where you have a 1D Array of Booleans and you want to turn one of them on for, say, 1 second, then turn it off and turn the next one on, and so on until you turn off the last one and turn the first one back on? [Note that this simple formulation has only an "On Time", as the "Off Time" for each LED becomes simply the Array Size - On Time]. That's even easier than the above, especially if you start out with an "Initialized Array of Boolean" which has the pattern (which need not be "only one LED on" -- in fact, you could create a 7 x 7N Array of Booleans, pre-initialize it by setting the N 7x7 sub-arrays with LEDs on to represent 5x7 Capital Letters that scrolls across the screen like the Times Square Marquee.
@Altenbach shouldn't need to help you with this one!
01-20-2023 11:15 AM
For significantly better testing algorithms, I would display the LED state on a chart vs time.
Here's one possibility using "simpler math":
As I said, once you have much more LEDs or the off time is shorter than the (# of LEDs x on time), multiple LEDs might be lit at any given time and you probably need to maintain an array of elapsed times.