State Machine: Trick or Treat
This Halloween themed state machine has two of the more obvious states (trick vs. treat) and a third, more passive state (no one is at the door).
The planned sensors and actuators are shown in this Paint diagram:
When someone arrives at the door, the program leaves the passive “no one at door” state. The visitor makes their intentions clear with a switch (trick vs. treat) which is displayed on a lit sign. In the “treat” state, the dispenser rolls out a tray of Oreo cookies. When the visitor leaves, the passive state resumes and the tray retracts. The “trick” state isn’t particularly useful with the current actuators; mostly it waits for the trickster to leave or request a treat.
I built all of the parts and programmed them, but the Oreo-dispenser doesn’t work on its own.
The Oreo Dispenser
The Circuit Board