From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
12-03-2015 01:25 PM
I am fairly new to LabView and have a traffic light project I need to do. Everything seems to work but I can't get my crosswalk buttons to work unless they are pressed during a certain event. I have tried using a feedback node and a shift register but neither one is giving me the desired results.
Solved! Go to Solution.
12-03-2015 01:38 PM - edited 12-03-2015 01:42 PM
Ouch! Try to do ity without a single local varaible or sequence structure! You can shrink your code to 10% of the complexity it has now!
Maybe you want to use a different mechanical action for the buttons.
(Note also that you have coercion dots on the state enum, meaning that not all are the same. Don't talk about events if you don't even use an event structure. Try to wire left-to-right and not all over the place.)
12-03-2015 01:45 PM
As Altenbach said, and you should look at an event structure. They can handle multiple controls in one event and get rid of the boolean as well.
12-03-2015 01:46 PM - edited 12-03-2015 01:47 PM
This is my first time using LabView and this project is due tomorrow. I have spent weeks trying to get this to work and I don't have time to try to start from scratch. I've tried using different mechanical actions for my buttons without any luck. I'm not sure what you mean about coercion dots? I thought I was using an events structure.
12-03-2015 02:05 PM - edited 12-03-2015 03:02 PM
No event structure anywhere! You are mixing two different enums, each with different items as state variable. That's a really bad idea. Use one enum that contains all states.
For me, starting from scratch would probably take 10 minutes to finish the program, while trying to fix your code would take half a day (exagerrating, of course!)
Plan out the code first:
Hey look! No local variables, no inner cases, and no sequence structures. It's magic! See how far you get. Good luck!
(Yes, you could also use an event structure instead of the case structure and use the timeout (kept in a shift register) to time the states. I don't recommend to do that with your experience and deadline).
12-03-2015 03:45 PM
I'm not sure exactly what you mean by "crosswalk button". It's hard to identify everything on there.
Also, if you could attach the missing control "STATE.ctl" we could actually try running it...
12-03-2015 04:22 PM - edited 12-03-2015 04:29 PM
Your crosswalk buttons are set to "Latch Until Released". To fix your problem, change them to Latch When Released and move the value read terminals inside of the appropriate case. This will let the values stay the way they are until your read the value in the case that cares about it. No shift registers needed and each crosswalk button type (N-S or W-E) gets handled separately.
Your VI needs much improvement past that, so here are some critiques:
This VI is very hard to wrap one's head around.
Cheers
--------, Unofficial Forum Rules and Guidelines ,--------
'--- >The shortest distance between two nodes is a straight wire> ---'
12-03-2015 05:15 PM - edited 12-03-2015 05:16 PM
So I started from scratch... I am having the same issues with the crosswalk buttons plus I also am not sure how to wire my crosswalk switches and turn switches in case "EW Y". At least my project looks more presentable 🙂
12-03-2015 05:28 PM - edited 12-03-2015 05:59 PM
Hey, that really looks much better!!!
I'll have a look at your logic but you probably need to retain the switch values until the respecitive lights are serviced, not just until the next iteration.
12-03-2015 06:03 PM
Here's a very quick draft how you would retain the TRUE until the relevant optional case has been sheduled of one of the buttons got triggered.
(Note that the code is not complete. You need to make sure all states are reached (e.g. the NW S buttons an others in that group are currently not read!)