Assignment 6: Electric Sheep
Objective
Use both LEDs and S2 switch to implement a counting-type game, where you can win by stopping the "counter" on 0x8000 (-/+ 32768). If you didn't stop on the correct number, toggle the direction in which the counter is moving. If you are counting up, the green light should be on, and if you are counting down the red light should be on.
Design
You should have a MAIN section that continually does something (think about what this is) and then a BUTTON_ISR section that does 1 of 3 things based on the value in the counter when the interrupt is serviced (what are these three things?). You may add more labels if needed, but these are provided for you.
Extras
- Slow down the counter (hint: use another)
- Do something interesting if you "win"
- Debounce the button in the interrupt handler
- Blink the correct LED every time it counts
- Make the speed settable (difficulty: easy, medium, hard?)