取消
显示结果 
搜索替代 
您的意思是: 

case selection using boolean on a text case structure

已解决!
转到解答

Hi

 

I'm a newbie to Labview and I'm learning with some small tasks.  I've created a traffic light system using a case structure/state machine that cycles through the RED, AMBER, GREEN colours.

 

What I would like to do now is put a button on the front panel that if pressed sets the traffic light to RED permanently, like in the event of an accident, and then when switched back or off the sequence resumes.

 

I've done some searches and with the case selection being text and buttons being boolean I'm struggling to come up with a reasonably solution.

 

Thanks in advance for any advice help.

0 项奖励
1 条消息(共 3 条)
5,004 次查看
解答
已被主题作者 blast_uk 接受

Here is a slightly cleaned up version which accomplishes what you were looking for.

 

Traffic Light.png

 

Some general notes about LabVIEW coding. Try to keep your block diagram neat and organized. That means minimize bends in wires and align your nodes. This helps make teh code much easier to read. In addition, the ENUMs in this code should be a typedefed ENUM. That way is you need to modify the ENUM all copies of it will be updated. If you simply copy and paster them you have to manually edit every one. (I didn't create the typedef and replace all the copies for you.) You would need a better state machine to handle the delay if you wanted to handle the accident condition in a more timely fashion. The "Wait" state would not wait the full duration but a small fraction of the time and repeat until your reach the desired time. This would allow the lights to switch to Red very quickly after the accident condition.

 

 

 

 

 



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
2 条消息(共 3 条)
4,997 次查看

Thank you Mark for the reply and the coding advice.

 

Your solution appears clear and simple which is what I was hoping for.

 

I will look at the code tomorrow as its 12.30am and I havn't got Labview on this machine.

 

Kind regards.

0 项奖励
3 条消息(共 3 条)
4,985 次查看