Snake w/uVGA II and MPR121
Overview
For this project I used a 4dSystems uVGA II and a MPR121 capacitive keypad to recreate the game known popularly as Snake on the Mbed. The program shows no title screen and immediately begins a round of the game. The player may use the one, four, five, and six keys on the keypad to control the snake. The object of the game is to collect as many red 'apples' as possible without running into the walls or the snake itself. When the player loses the game, the score is shown and the player is prompted with a key press and hold (five) to restart the game.
Components
Demonstration
The MPR121 should be installed such as in the video so that the user buttons are oriented correctly.
Circuit
The uVGA in this project is connected to an external 5V supply. Be sure to connect both the external ground and the mbed's.
mbed | uVGA II |
---|---|
p9 | RX |
p10 | TX |
p11 | RESET |
The MPR121 requires to 4.7k Ohm Pullups on the data lines (p28, p27).
mbed | MPR121 |
---|---|
Vout 3.3V | VCC |
p28 | SDA |
p27 | SCL |
p26 | IRQ |
Libraries & Code Utilized
- uVGA II Library uVGA II library. Originally created by Stephane Rochon and modified by Adam Green.
- MPR121 MPR121 keypad code. Originally created by Anthony Buckton and modified by Jim Hamblen.
Wish List
- Add a high score list to the top of the screen. It wouldn't hinder performance since it would only be redrawn when the game is restarted
- Replace the red 8x8 apple with a 8x8 apple bitmap.
- Replace the head of the snake with a 8x8 sprite.
Import programMbed_Snake
Snake version w/uVGA II and MPR121
Please log in to post comments.