11-11-2022 08:55 AM
I want constructive criticism. I know I have a lot of case structures, but I know someone in this forum can get this done with a single while loop and couple of logics. His first name starts with C and last name starts with A. Those who know, knows who I am talking about.
But what do you think about what I have accomplished? I am so happy that I've learned a lot. Soon I will no longer be a baby programmer. Thanks God!
Feel free to share how you would do yours. Let's do code demonstration of simple stuff.
11-11-2022 10:39 AM
11-11-2022 11:19 AM
See attached for a quick literal rewrite. Make sure you understand it fully.
11-11-2022 12:35 PM
In the US, the middle light is usually referred to as 'yellow'. Also, the green is more of a blue-green. The actual chromaticity ranges are specified by law (but I couldn't find them); however I've adjusted the colors to make them a bit closer.
I've also attached an old traffic light control that I made years ago.
11-11-2022 01:45 PM
Thanks Mr. Altenbach! These are very good advice. Also, I like how simple you made it look, using only 3 cases. I knew it would be a piece of cake for you. lol.
I have a question about what you did here: https://forums.ni.com/t5/LabVIEW/PUT-TIMER-AT-TRAFFIC-LIGHT/m-p/4046577#M1160741
How are you able to insert booleans (G, Y, R) in enum? How did you do that?
11-11-2022 01:47 PM
Thank you, Mr. Paul_cardinale, for your input. Good to know!
11-11-2022 02:45 PM
I wish every LabVIEW developer were as enthusiastic as you.
11-11-2022 03:44 PM
@GRCK5000 wrote:
Thanks Mr. Altenbach! These are very good advice. Also, I like how simple you made it look, using only 3 cases. I knew it would be a piece of cake for you. lol.
I have a question about what you did here: https://forums.ni.com/t5/LabVIEW/PUT-TIMER-AT-TRAFFIC-LIGHT/m-p/4046577#M1160741
How are you able to insert booleans (G, Y, R) in enum? How did you do that?
That's a radio buttons control (q.v.)
11-11-2022 04:42 PM - edited 11-11-2022 04:47 PM
@GRCK5000 wrote:How are you able to insert booleans (G, Y, R) in enum? How did you do that?
A radiobutton container (boolean palette) is similar to a cluster, but it can only contain booleans. Any style and number of booleans!!!!
Only exactly one (or also none of so configured) can be TRUE at any given time, As soon as another one turns true, all others turn false automatically. This is very useful and often dramatically simplifies your code.
In your case, you would place a radiobutton control from the palette, then drop your three LEDs in it. Now you can remove the two booleans that were originally in there. You can change the cluster order if needed. Of course you can make it a control (typical) or an indicator (as in this case).
The type is an enum with values for all element names in cluster order. The current value of the enum is the label of the element that is currently true, so make sure all elements have unique and clear labels, even if they don't show on the front panel.
( Also have a look at my description here and vote for it if you like. 😄 )
11-12-2022 01:51 PM
🤣 I just love what I do. Accomplishment brings even more happiness. Thanks God!