|
| def | __init__ (self, pwm, startState=0) |
| | A constructor that initializes all data stored in a simonSays object. More...
|
| |
|
def | runStateMachine (self) |
| | A function that runs through the state machine logic of the simonSays object once.
|
| |
| def | generateLevel (self, length, maxDurration) |
| | A function that creates the pattern for the user to replicate. More...
|
| |
| def | displayLevel (self, level, tick, tempo=1) |
| | A function that flashes the LED in a randomly generated pattern. More...
|
| |
| def | listenForLevel (self, level, tick, tolerance=0.25, tempo=1) |
| | A function that compares the timing of the user buttom presses to the previously displayed pattern. More...
|
| |
| def | onButtonChangeFCN (self, IRQ_src) |
| | A function that sets buttonChange to True when the blue button state changes and negates the current button state. More...
|
| |
| def | transitionStates (self, trans, st, customMessage="", checkBounce=False) |
| | A function that preforms all repetative tasks durring a state change. More...
|
| |
|
|
| currentLevel |
| |
|
| highScore |
| | The user's highest score since startup.
|
| |
|
| currentScore |
| | The user's current score.
|
| |
|
| levelNumber |
| | The current level number the user is on.
|
| |
|
| tempo |
| | The speed of the pattern, in seconds/beat.
|
| |
|
| levelLength |
| | The length of the levels, in number of flashes.
|
| |
|
| maxFlashLength |
| | The max durration, in beats, of a flash or rest.
|
| |
|
| buttonState |
| | The current state of the button (True = pressed)
|
| |
|
| state |
| | The current state of the finite state machine.
|
| |
|
| lastTransition |
| |
|
| buttonPress |
| | Wether or not the button state has changed (True = pressed or released).
|
| |
|
| buttonRelease |
| |
|
| pinC13 |
| |
|
| ButtonChangeInt |
| |
|
| pwm |
| |
|
| dictionary | stateMessages |
| | dictionary of messages to display at each state change More...
|
| |
|
list | incLengthAt = [4, 6, 10, 15, 20] |
| | List of level numbers to increase the level length at.
|
| |
|
list | incTempoAt = [2, 3, 5, 9, 11, 13, 14, 15, 16, 17, 18, 19, 20] |
| | List of level numbers to increase the speed (tempo) at.
|
| |
|
list | incmaxFlashLengthAt = [2, 5, 12, 20] |
| | List of level numbers to increase the max flash durration at.
|
| |
A class that plays simon says with the user using an LED and a button.
The simonSays class randomly generates a sting of LED flashes of varying length. Then, it compares the durration of button presses by the user to the pattern, and if they are sufficiently close, congratulates the user and generates another random sequence for them to replicate.