A reintroduction to Python and finite state machines. More...
Classes | |
| class | lab01.Conditions |
| Class to keep track of vending machine conditions to instruct master mind. More... | |
Functions | |
| def | lab01.printWelcome () |
| Prints welcome message. More... | |
| def | lab01.state0 (c) |
| Perform State 0 operations. More... | |
| def | lab01.state1 (c) |
| Perform State 1 operations. More... | |
| def | lab01.state2 (c) |
| Perform State 2 operations. More... | |
| def | lab01.state3 (c) |
| Perform State 3 operations. More... | |
| def | lab01.state4 (c) |
| Perform State 4 operations. More... | |
| def | lab01.state5 (c) |
| Perform State 5 operations. More... | |
| def | lab01.state6 (c) |
| Perform State 6 operations. More... | |
| def | lab01.state7 (c) |
| Perform State 7 operations. More... | |
| def | lab01.state8 (c) |
| Perform State 8 operations. More... | |
| def | lab01.state9 (c) |
| Perform State 9 operations. More... | |
| def | lab01.state10 (c) |
| Perform State 10 operations. More... | |
| def | lab01.state11 (c) |
| Perform State 11 operations. More... | |
| def | lab01.state12 (c) |
| Perform State 12 operations. More... | |
| def | lab01.state13 (c) |
| Perform State 13 operations. More... | |
| def | lab01.state14 (c) |
| Perform State 14 operations. More... | |
| def | lab01.state15 (c) |
| Perform State 15 operations. More... | |
| def | lab01.main_loop (c) |
| FSM Main loop. More... | |
| def | lab01.main () |
| Main. More... | |
A reintroduction to Python and finite state machines.
The goal of this lab is to regain comfort with python and the concepts learned in ME 305 by developing a program that "embodies the function of a vending machine."
| def lab01.main | ( | ) |
Main.
Initialize FSM
| def lab01.main_loop | ( | c | ) |
FSM Main loop.
Implement the FSM using a while loop and an if statement. Will run eternallly intil the user presses CTRL-C
| c | A Conditions object used to keep track of the conditions of the vending machine |
| def lab01.printWelcome | ( | ) |
Prints welcome message.
Prints a Vendotron^TM^ welcome message with beverage prices
| def lab01.state0 | ( | c | ) |
Perform State 0 operations.
This init state intializes the FSM itself
| c | A Conditions object used to keep track of the conditions of the vending machine |
| def lab01.state1 | ( | c | ) |
Perform State 1 operations.
Displays the startup message and awaits any input from the machine before incrementing the state
| c | A Conditions object used to keep track of the conditions of the vending machine |
| c | A Conditions object used to keep track of the conditions of the vending machine |
| def lab01.state10 | ( | c | ) |
Perform State 10 operations.
Raise return money flag so that money is returned on the next MM loop
| c | A Conditions object used to keep track of the conditions of the vending machine |
| def lab01.state11 | ( | c | ) |
Perform State 11 operations.
Dispense soda and recalculate current balance
| c | A Conditions object used to keep track of the conditions of the vending machine |
| def lab01.state12 | ( | c | ) |
Perform State 12 operations.
Return change and reset to State 1
| c | A Conditions object used to keep track of the conditions of the vending machine |
| def lab01.state13 | ( | c | ) |
Perform State 13 operations.
Reset flags and return to state 1
| c | A Conditions object used to keep track of the conditions of the vending machine |
| def lab01.state14 | ( | c | ) |
Perform State 14 operations.
Wait for key to be pressed
| c | A Conditions object used to keep track of the conditions of the vending machine |
| def lab01.state15 | ( | c | ) |
Perform State 15 operations.
Wait for key to be released
| c | A Conditions object used to keep track of the conditions of the vending machine |
| def lab01.state2 | ( | c | ) |
Perform State 2 operations.
Master Mind dictates which state operates next based on the flags raised
| c | A Conditions object used to keep track of the conditions of the vending machine |
| def lab01.state3 | ( | c | ) |
Perform State 3 operations.
The Cuke Handler sets the current soda selection and price. If the balance is insufficient an error is raised
| c | A Conditions object used to keep track of the conditions of the vending machine |
| def lab01.state4 | ( | c | ) |
Perform State 4 operations.
The Popsi Handler sets the current soda selection and price. If the balance is insufficient an error is raised
| c | A Conditions object used to keep track of the conditions of the vending machine |
| def lab01.state5 | ( | c | ) |
Perform State 5 operations.
The Spryte Handler sets the current soda selection and price. If the balance is insufficient an error is raised
| c | A Conditions object used to keep track of the conditions of the vending machine |
| def lab01.state6 | ( | c | ) |
Perform State 6 operations.
The Dr. Pupper Handler sets the current soda selection and price. If the balance is insufficient an error is raised
| c | A Conditions object used to keep track of the conditions of the vending machine |
| def lab01.state7 | ( | c | ) |
Perform State 7 operations.
Update the balance besed on the coin inserted. Raise a flag to update the display to reflect the new balance
| c | A Conditions object used to keep track of the conditions of the vending machine |
| def lab01.state8 | ( | c | ) |
Perform State 8 operations.
If error flag is raised it's because there's an insufficient balance
| c | A Conditions object used to keep track of the conditions of the vending machine |
| def lab01.state9 | ( | c | ) |
Perform State 9 operations.
Update the display to the message stored in disp_next
| c | A Conditions object used to keep track of the conditions of the vending machine |