"Simon" is a sequence matching game. The game flashes an LED and plays a tone. The human has to press the button associated with the LED (and tone). If the human presses the correct button, then the game repeats the first event and adds a second event. The human must now match the two events. If the human presses the correct sequence of two buttons, the game repeats them and adds a third event. There is a time limit for human response, perhaps one second per button push. When the human presses a correct button, the appropriate tone is played and the LED lights. If the human makes a mistake, the game produces a rude sound, flashes all the LEDs and stops until it is reset.
You will construct such a game using four of the LEDs and buttons on the development board and a earphone (or speaker) which you attach to one output bit.
You can generate specific audio frequencies using an interrupt-driven scheme like the one described in Lab 1, but with variable timer reload values. One of the portD or portB pins will be used to drive an earphone. The ports can drive the earphone directly, but you can make it louder with a 74xx driver or an opamp. You could also use amplified speakers or your own earphones.
Write a program which implements
C4 262 Hz (middle C) D4 294 E4 330 F4 349
You will demonstrate the game to a staff member. Be sure to point out any enhancements you have made such as variable speed, introductory tunes, or better error noises.
Your written lab report should include: