12-03-2024 09:54 AM
Hey there,
I'm relatively new to the world of LabVIEW and currently struggling to work out my homework task.
The task was the following:
I figured out how to implement mode 1 and 2 (I will add a link to the project) but I don't know how to mode 3.
Here's what I currently got:
I embedded the whole code in a producer/consumer structure.
Right now, LED1 is flashing 5 times before LED2 flashes one time, then it gets back to LED1 flashing. I know that this is because of the way I defined the inner case structure.
Is the approach with the inner case structure valid?
I will probably need another array but right now I'm pretty much stuck, so I'm thankful for any kind of help!
I am working on Labview 2021.
12-03-2024 10:14 AM - edited 12-03-2024 11:08 AM
This is a very simple task and you have way too much code for such a simple problem. All you need is a simple state machine running at a constant rate that changes state as a function of elapsed time and mode.
I'll have a look....
12-03-2024 11:07 AM
See if this can give you some ideas....
Note that the loop spins at a constant 50ms and changes state as a function of accumulated time. This is especially useful for longer time delays that would interfere with responsiveness. You want to read the controls often, even if the delay is 30 seconds.
(of course your teacher reads this forum too, so make sure you fully understand the logic, then apply selected ideas to your code. Be creative!)
12-04-2024 09:18 AM
Hi altenbach,
thank you very much for taking the time and designing the code!
There are definitely some ideas which i will use, e.g. the clustering and using more of "or"/"and" logic.
However, i think my original message might have been somewhat misleading. The mode "flash 5 times" does not refer to all LEDs flashing simultaneously for only 5 times. It was rather supposed to look like this: The first LED flashes 5 times while all other LEDs are off. Then the second LED flashes 5 times and so on. All this going on indefinitely.
I am pretty sure that I can make this work with "replace array subset" but it still really throws me off...
And concerning my prof: He will for sure be around the forum from time to time but the homework is voluntary and not graded. So this should not be a problem 🙂
12-04-2024 09:51 AM
Yes, I did not read the description in detail, but your "5" mode would only requite some very minor changes to implement, It is just a longer cycle with otherwise very similar logic. (It is actually simpler than the current 5 flash cycle). Try it!
You could actually add many more flashing modes by just adding items to the enum and adding more cases. Scalability is always good!