Bumper Button Game
> Exec_Summary
> Instructions
The rules of this game are provided in the code template verbatim as follows:
"Instructions: This game is one of memorization. Prior to the " "beginning of this game, you can press all of the bumper buttons to see their associated color. This will not change for the duration of the game." "Afterwards, to begin the game, press the pushbutton on the circuit atop the car. It will show a sequence of five colors which will be the order until completion of the game" "After this, the same sequence will show, however, only four colors will be shown. It is now your job to input the last color of the sequence using the bumper buttons." "This pattern of losing a color in the sequence will continue until only one color is shown. You will only have three seconds to input your individual response (i.e. three seconds for red, another " "three seconds for green). If completed correctly, the LED in the circuit atop the car will begin to blink green, if you do not finish the sequence within the given time or" "give an incorrect pattern, the LED will begin to blink red. Have fun and enjoy this game!!"
> System_Architecture
The program compartmentalizes behavior using functions. We created SysInit(), GPIOinit(), and Timer_Init() using the Hardware Abstraction Layer functions for MSP microcontrollers. These ensure pin I/O directions are set and clocks are configured properly.
The lightSwitcher function toggles lights in a random order based on system time, while the holdOn function delays the microcontroller in 25ms increments. The userInput() function is the core of the logic, handling the input order and ensuring the correct sequence is pressed to proceed. While a button is pressed, a blocking while loop prevents the code from proceeding until un-pressed.