Mechatronics Portfolio - Nick Greco
ME405_Lab0x01.py File Reference

A vending machine simulating drink selection & payment via keyboard entries. More...

Functions

def ME405_Lab0x01.kb_cb (key)
 Callback function which is called when a key has been pressed.
 
def ME405_Lab0x01.VendTask (denomDict)
 Allows for the purchase of drinks with certain denominations. More...
 

Variables

string ME405_Lab0x01.last_key = ''
 
int ME405_Lab0x01.WelcomeState = 0
 
int ME405_Lab0x01.DrinkNCoin = 1
 
int ME405_Lab0x01.ComputeVend = 2
 
int ME405_Lab0x01.Eject = 3
 
dictionary ME405_Lab0x01.denomDict
 
def ME405_Lab0x01.getDrink = VendTask(denomDict)
 Creates a generator object. More...
 

Detailed Description

A vending machine simulating drink selection & payment via keyboard entries.

        <B>source code:</B> https://bitbucket.org/nicho755/me-305-labs/src/master/ME405_Lab0x01_Vendotron/ME405_Lab0x01.py
Author
Nicholas Greco
Date
4/18/2021

Function Documentation

◆ VendTask()

def ME405_Lab0x01.VendTask (   denomDict)

Allows for the purchase of drinks with certain denominations.

Keyboard callbacks enable the user to select a desired drink and to pay for said drink from a fixed variety of denominations.

Parameters
denomDictLists the possible denominations, from largest to smallest, that the user can pay with. Their values are integers specified in dollar amounts.
Returns
Returns the current state of the VendTask FSM

Variable Documentation

◆ denomDict

dictionary ME405_Lab0x01.denomDict
Initial value:
1 = {
2  "Hamilton" : 10,
3  "Lincoln" : 5,
4  "Washington" : 1,
5  "Quarter" : 0.25,
6  "Dime" : 0.10,
7  "Nickel" : 0.05,
8  "Penny" : 0.01
9  }

◆ getDrink

def ME405_Lab0x01.getDrink = VendTask(denomDict)

Creates a generator object.

Creating a generator object will allow us to iterate through this theoretically infinite sequence per cycle of the FSM.