01-19-2023 02:45 PM
You're definitely right. Now, you know exactly what I'm talking. Thanks! This will make it clear for others. I'm working on the math and will post what I get. I've been struggling a little bit, but what you had 3*2.65 = 7.95 kind of gave me an idea.
01-19-2023 03:35 PM
Hi Mr. Altenbach,
sorry for messing your code up haha.
But would you please refer to my conversation with GERDW? He knows exactly what I'm trying to achieve.
01-19-2023 04:00 PM - edited 01-19-2023 04:30 PM
Hi GerdW,
What do you think about what I have now? see attached code. It kind of seems like it's working, but I am still not sure if each relay is being off for 9 seconds. I tried using my phone timer, it seems like they are being turned off for a little bit more than 9 seconds. but it looks okay to me. Feel free to share any knowledge or better way to do it. I'm here to learn. There is always room for more knowledge.
Hopefully, this code brings more clarification on what I am trying to achieve.
01-19-2023 05:03 PM
@GRCK5000 --
Your title is wrong! You don't need "Code modification", you need to simply read (tutorial material, LabVIEW books, though I don't have one in mind to recommend, the training material mentioned at the beginning of this Forum), pay attention to what you read, don't skip, do simple things before doing complicated things, and PLAN.
Consider the statement of your Problem. Turn LED On (for 1 second), then off (for 9 seconds). You don't say, but presumably "and repeat until I push the Stop button".
OK. A Quiz:
Write these steps down "in your head", but do not put them on a Block Diagram (yet). Open LabVIEW. Open the Timing Palette. Do you see a function (maybe in the upper-right corner) called "Stall Data Flow.vim"? Read the Detailed Help associated with this function.
I am deliberately NOT including the (almost trivial) code that I wrote. Please indulge me and take the simple Quiz I provided to you -- it will, I hope, get you to start thinking "WHAT do I want to do", instead of "How can I use the limited things that I have learned, without considering if they are appropriate to my problem, but can make a very involved VI that convinces people I know what I'm doing". Good LabVIEW code is often Simple LabVIEW code.
Bob Schor
P.S. -- I'll post my VI in a day or so, unless you follow my suggestion to "take the quiz" and figure out the Much Better Way (IMHO) to solve your problem yourself.
01-19-2023 05:27 PM - edited 01-19-2023 05:27 PM
I personally would achieve this with a simple state machine or flat sequence structure. My code would be completely different from Mr. Altenbach's code. My code would be probably extremely large. He is able to do this using a single small while loop. It's just unbelievable.
01-19-2023 05:59 PM
Again, you completely butchered my earlier code. See if this can give you some ideas....
(... and Please (!!!) don't maximize the front panel to the screen. That's just annoying!)
01-19-2023 06:01 PM - edited 01-19-2023 06:01 PM
But state machine is my favorite tool. I'll probably change my name to "TheStateMachineMaster" 😂
01-19-2023 06:12 PM
Mine IS a state machine in the general sense!
01-19-2023 06:17 PM - edited 01-19-2023 06:31 PM
Thanks Mr. Altenbach! From the code you attached it seems like each LED is being off for more than 9 seconds. In 1 complete cycle, I would like each LED to be OFF for 9 seconds.
For example, when you run the program. The flow goes like LED 1> ON OFF, LED 2 > ON OFF, LED > ON OFF, LED 4 > ON OFF = 1 cycle.
So 1 cycle is complete when the 4th LED turns OFF. So in 1 complete cycle, each LED should be OFF for 9 seconds and ON for 1 second. 1 complete cycle should equal to 10 seconds I believe.
I think the problem is with my wording. 😔
01-19-2023 06:27 PM
Of course the LEDs will also be off if it is not the current led. You can't have both.
Do you mean that after 10 second #1 and #2 should be on? At the end all should be on?
If each led should have its own timing, you need to maintain an array of times. Easy to do with minimal changes.