Lite / Building Machines That Respond / Week 23
Week 23: Simple state machines
This week you will
- Describe a machine's behaviour as states, events and transitions.
- Draw and trace a state diagram for a timed sequence such as traffic lights.
- Implement a state machine in Python-style code and test it with event lists.
Lessons
- States, events and transitions · about 30 min
An automatic door is closing when someone walks up. Should it keep closing? How would a machine even know what it is doing? - Timed sequences: the traffic light · about 35 min
A traffic light has no buttons in its basic form. What makes it change, and how do you prove it is never green both ways? - A state machine in twelve lines · about 30 min
Can a whole automatic door fit in one variable and a handful of ifs?