SP.710: Intro to Microcontrollers

 Day 5->?: Simon

The purpose of this project is to get used to writing more involved
 programs that use variables, arrays, persistent memory, timing,
 and so on.

For this project, there will be several pre-soldered "switch boards"
 which contain 4 switches, each with a built in LED. The general idea
 of this project is to plug this switch board into the PIC and use it
 to play "Simon". (also known as "Memory", the game where a sequence
 of lights flashes and you have to press the buttons in the same
 order, then a longer or faster-paced sequence of lights flashes and
 you have to press the buttons for that sequence, etc... until you
 make a mistake).

Feel free to skip any of these parts if you want to jump ahead,
 and if you have other ideas for extensions to this project, let
 us know and try them out.


Electronics:

0) The plug coming out of the "Simon Board" is a row of header
   pins connected to both switches and LEDs on the Simon Board.
   Wire up your board with the appropriate resistors/wires to
   connect the switches and LEDs to I/O pins on the PIC.

Warmup:

0.1) Write a quick program that will let you verify that the four
   switches and four LEDs all work and are connected correctly.

0.2) program (iiiB) from the serial section is good practice with
   arrays (a way of storing lists of data which may be useful
   in this project).


Simon Says the Game:

1) This project should have the following features when completed:
    (you may want to ignore some of them initially and get a simpler
    version working):

* When you turn on the PIC, the LED next to the PIC flashes and/or
   a message is printed to a computer serial port (if connected),
   letting you know that the program is working.

* When the player presses a button, the game begins:

* One light flashes. The player must press that button within
  a preset amount of time or the player loses. Assuming they
  press the right button in time, the program then flashes two
  LEDs in sequence. The player must press those two buttons
  in the right order within some time interval, and so on.

* When the player (eventually) messes up, the lights should all
   flash or the program should print a message to the serial port
   indicating that the game is over. Then the program should wait
   for the player to press a button and start the game over again.


2) Improve the game by adding one or more of the following features:

* As the game goes on the LEDs should start flashing faster and
  faster.

* There should be a switch to set "normal" or "expert" mode.
  Expert mode should be harder in some ways, such as having
  the program sometime light up two LEDs at once (and the user
  must press both of the corresponding buttons at once when they get
  to replaying that part of the pattern).

* The program should keep track of a high score and send
  that information to a computer over the serial port when
  the game is over.

* The PIC should store high scores internally, even when the
  power is turned off (keywords: EEPROM Data Memory... ask for
  more info on this).

* The PIC should allow the user to type in a name or three initials
  over the serial port if the user gets the high score. This score
  and the initials should be stored internally and printed out over
  the serial port at the end of each game.

* Add sounds to the project (we have some buzzers that can
  be driven at different frequencies to produce different
  tones... ask one of us for more details)

* Improve the game in various other ways that you come up with!