After flashing one of the many 'hello world' demos into my MSP430G2231 I needed a project which would challenge and reward me in equal measure. With that in mind I conceived to build a game which would require no extra parts; just the LaunchPad and the MSP430.
I wanted to gain a little experience programming LEDs, switches, timers and interrupts. The first workable idea encompassing all these that came to mind was a simple time-lapse guessing game. The premise is to accurately guess when a parcel of time has passed by pressing a button.
There are two difficulty modes. Easy will blink the green LED ten times, you must press the button on the tenth blink. Hard will blink the red LED five times but still count up to ten iterations internally. You must press the button on the invisible tenth period.
If you win the green LED will light up. If you are too quick with your guess the red LED will flash quickly, if you are too slow it was flash slowly.
Enough babbling, here's some code:
I developed this on the MSP430G2231 but have since moved it to the MSP430G2211. Even so, this MCU is overkill for such a simple project but these are the only two processors I have at the moment.
In a future update I'll be adding PWM control of the LEDs for a more polished look and feel. I may even add a sprinkling of audio. But I'd like to keep the game fully playable with no extra components to the LaunchPad.
Feel free to use and abuse the code and feedback any ideas or improvements of your own!