State Machines Part 3 - Dish Washer Example
State Machines
In class Lab - Dishwashing Machine
In class Lab - Dishwashing Machine
- We are going to build a simple dish washing machine with three cycles
- Economy
- Deluxe
- Super Deluxe
- Each cycle will wash and dry the dishes in some manner
- The washer has a knob to change cycle (pot), a light to show the current state (RGB), and it starts automatically when the door is closed (magnetic switch)
Cycles and States
Cycles |
States |
Economy |
Idle (white) |
Deluxe |
HotWash (red) |
SuperDeluxe |
ColdWash (blue) |
|
RegularDry (orange) |
|
ExtraDry (yellow) |
Transitions
- The potentiometer position determine the state by divide the potentiometer into 3 ranges
- The first state will start when the / switch is closed, and the next states will happen automatically on a
millis
timer
Transitions
Economy |
Deluxe |
SuperDeluxe |
Idle if until button pressed |
Idle if until button pressed |
Idle if until button pressed |
ColdWash (2 min) |
HotWash (2 min) |
HotWash (2 min) |
RegularDry (2 min) |
RegularDry (2 min) |
ExtraDry (4 min) |
Idle |
Idle |
Idle |
In class Lab - Dishwashing Machine
- Download starting code
- Go to https://bit.ly/ProjectZip
- Paste the following link into the top right
https://github.com/reparke/ITP348-Physical-Computing/tree/main/_exercises/week07/washer_start
- Wire device as shown below
Wiring Diagram
Components
- 1 RGB
- 1 potentiometer
- 1 magnetic switch (pushbutton will work too)
Wiring Pin Guide
LED |
Photon 2 Pins |
Magnetic Switch |
D5 |
RGB Red LED |
A2 |
RGB Green LED |
A5 |
RGB Blue LED |
D15 (MO) |
Potentiometer |
A1 |
General Approach
Diagram
Credits