Implementing Finite State Machine
i have been reading finite state machines (fsm) want implement 1 project.
i found this thread in post#5 has link digital diy article on implementing fsm.
my project involves reading state of brew switch on espresso machine, controlling machine's pump, reading data load cell.
the fsm pulse pump on 1 sec, off 2 sec (repeat twice), turn pump on 25 sec while reading , printing mass load cell every 1/2 sec. once reaches 25 sec turns pump off & sounds buzzer 2 sec on, 5 sec off tell user turn brew switch off. if user doesn't turn off brew switch, sounds buzzer again until user complies.
so wrote out static (s) & transitional (t) states following guidelines digital diy article follows:
1. wait brew switch turned on (s)
2. turn pump on, take note of time, tare load cell (t)
3. wait 1 sec pass (s)
4. turn pump off, take note of time (t)
5. wait 2 sec pass, increment counter1 (s)
6. goto step 2 if counter1 < 3, otherwise goto step 7 (t)
7. turn pump on, take note of time (t)
8. wait 1/2 sec pass (s)
9. print mass , time, increment counter2 (t)
10. goto step 7 if counter2 < 50, otherwise goto step 11 (t)
11. turn off pump, turn on buzzer, take note of time (t)
12. wait 2 sec (s)
13. turn buzzer off, take note of time (t)
14. wait 5 sec (s)
15. check brew switch, if still on, goto step 11, otherwise goto step 16.
16. goto step1.
but if user wants rinse after pulling shot? unsure of how should writing state machine case.
can suggest how this?
i found this thread in post#5 has link digital diy article on implementing fsm.
my project involves reading state of brew switch on espresso machine, controlling machine's pump, reading data load cell.
the fsm pulse pump on 1 sec, off 2 sec (repeat twice), turn pump on 25 sec while reading , printing mass load cell every 1/2 sec. once reaches 25 sec turns pump off & sounds buzzer 2 sec on, 5 sec off tell user turn brew switch off. if user doesn't turn off brew switch, sounds buzzer again until user complies.
so wrote out static (s) & transitional (t) states following guidelines digital diy article follows:
1. wait brew switch turned on (s)
2. turn pump on, take note of time, tare load cell (t)
3. wait 1 sec pass (s)
4. turn pump off, take note of time (t)
5. wait 2 sec pass, increment counter1 (s)
6. goto step 2 if counter1 < 3, otherwise goto step 7 (t)
7. turn pump on, take note of time (t)
8. wait 1/2 sec pass (s)
9. print mass , time, increment counter2 (t)
10. goto step 7 if counter2 < 50, otherwise goto step 11 (t)
11. turn off pump, turn on buzzer, take note of time (t)
12. wait 2 sec (s)
13. turn buzzer off, take note of time (t)
14. wait 5 sec (s)
15. check brew switch, if still on, goto step 11, otherwise goto step 16.
16. goto step1.
but if user wants rinse after pulling shot? unsure of how should writing state machine case.
can suggest how this?
but if user wants rinse after pulling shot?i don't understand terminology but, firstly, how can program know user wants rinse?
Arduino Forum > Using Arduino > Programming Questions > Implementing Finite State Machine
arduino
Comments
Post a Comment