From the course: Learning LabVIEW

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Solution: Traffic light

Solution: Traffic light - LabVIEW Tutorial

From the course: Learning LabVIEW

Solution: Traffic light

(upbeat music) - [Instructor] To build my state machine for the traffic light challenge, the first step is to create an enum for the three possible states. I'll right click on the block diagram, go to the numeric palette and select enum constant. I'll right click on that and go to edit items and then click the insert button. Now I can type out my three states, green, press enter, yellow, enter, and red, and click okay. It's always good practice to turn the enum for a state machine into a type def, so I'll right click on it and choose make type def. Next, I'll build the framework for my state machine by adding a while loop from the functions palette structures menu, and then I'll add a case structure inside of that. Again from the structures menu, case structure. Next, to implement the transition between states, I'll right click on the while loop and add a shift register, and then I'll wire the enum value for…

Contents