summaryrefslogtreecommitdiff
path: root/examples/statemachine/trafficLightDemo.py
blob: 30fe934c3853be20f36da10094b97106931a858a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import statemachine
import trafficlight

tl = trafficLight.Red()
for i in range(10):
    print(tl, end='')
    print(("STOP", "GO")[tl.carsCanGo])
    tl.crossingSignal()
    tl.delay()
    print()

    tl = tl.nextState()