Build a traffic light controller from scratch - step by step.
A simple traffic light sequence with:
traffic-lightYou get three files:
traffic-light/
machine.machine # Project configuration
main.seq # Main Sequence diagram

from automation_machine import Sequence, StepType, ActionInstruction
class TrafficLight(Sequence):
def setup(self):
# Define steps
s0 = self.add_step(StepType.INITIAL, name="Red")
s1 = self.add_step(name="Green")
s2 = self.add_step(name="Yellow")
# Timed transitions
self.add_transition(s0, s1, condition="timer_red.Q")
self.add_transition(s1, s2, condition="timer_green.Q")
self.add_transition(s2, s0, condition="timer_yellow.Q")
# Actions - lights ON while step is active
s0.add_action("red_light", "Red light on")
s1.add_action("green_light", "Green light on")
s2.add_action("yellow_light", "Yellow light on")
# Timers - each step has its own duration
s0.add_action("timer_red", "Red phase timer", instruction=ActionInstruction.TON, duration=10000)
s1.add_action("timer_green", "Green phase timer", instruction=ActionInstruction.TON, duration=8000)
s2.add_action("timer_yellow", "Yellow phase timer", instruction=ActionInstruction.TON, duration=3000)
Save the file. The visual editor instantly shows the Sequence diagram.
self.add_step(StepType.INITIAL) creates an initial step - the starting point of your Sequence (shown with a double border in the editor).s0.add_action("red_light", "Red light on") uses the default Non-stored (N) qualifier - the action runs continuously while its step is active and stops when the step deactivates.instruction=ActionInstruction.TON uses the TON (On-delay timer) instruction. The timer starts when the step activates, and its .Q output becomes TRUE after the specified duration (in milliseconds).Open main.seq and write the following program. This creates three steps connected by timed transitions, with actions that control the lights.
The PLC Emulation engine lets you test your program without physical hardware.
red_light turns ONUse F10 to single-step through the emulation one scan cycle at a time. This is helpful for understanding exactly when transitions fire and steps change.
Open the Variables panel in the sidebar. You will see real-time values updated by the emulation engine:
red_light: TRUE when Step 0 is activegreen_light: TRUE when Step 1 is activeyellow_light: TRUE when Step 2 is activeYou can force variable values during emulation to test edge cases. See Variable Management for details.
Congratulations! You have built and tested your first AutomationView project. Here are some ideas to explore next.
Try extending this project: