Skydiving Game!
Overview
This is a game developed on an ARM Microcontroller (LPC 1768). We used a smart color LCD(uLCD-144-G2), Navigation Switch, a speaker, an amplifier and a MicroSD card reader.
The goal of this game is to fall through the air, avoiding objects, then open your parachute at the appropriate time to land on a specified landing mat. The game starts with a countdown from three. Once the game starts, the black circle represents the skydiver falling through the sky. As the skydiver falls, the user uses the navigation switch to move left and right dodging obstacles which are colorful rectangles. Once the skydiver reaches a certain point, the user is prompted to hit the fire button on the navigation switch to launch the parachute. Once the parachute is launched the user will guide the parachute onto the red landing pad. If you do this, you win! If you touch the green, hit an obstacle, or don’t open the parachute, you lose!
The code for this game was written in C++ using the mbed cloud complier. We used the mbed’s Real Time Operating System (RTOS) to implement threads that control the different components of the game. Mutex locks are used to access the shared resource (LCD) between the threads.
Connections
mbed | uLCD Header | uLCD Cable |
---|---|---|
Vu 5V | 5V | |
GND | GND | GND |
TX(P28) | RX | TX |
RX(P27) | TX | RX |
P30 | Reset | Reset |
Table 1: mbed to uLCD connections
mbed | Nav Switch |
---|---|
Gnd | - |
P12 | U-up |
P11 | C-center or fire |
P10 | L-left |
P9 | D-down |
P8 | R-right |
nc | + |
Table 2: mbed to navigation switch connections
mbed | MicroSD |
---|---|
P8 (DigitalOut) | CS |
P5 (SPI mosi) | DI |
Vout | VCC |
P7 (SPI sclk) | SCK |
Gnd | GND |
P6 (SPI miso) | DO |
CD | CD |
Table 3: mbed to MicroSD connections
mbed | TPA2005D1 | Speaker |
---|---|---|
gnd pwr | - (gnd), in - | |
Vout (3.3V) or 5V | pwr + | |
P18 (D/A) | in + | |
out + | + | |
out - | - | |
Any DigitalOut px(optional) | S (low for shutdown) |
Table 4: mbed to audio amp to speaker connections
Figure 1. Setup
Demo
Code
Import programSkydiving
A skydiving game created using an mbed. This code used threads and mutexes to create a skydiving simulation on an uLCD. The sounds being played are read off of a microSD card and played through the speakers. The user controls the skydiver's movements with a navigation switch.
Please log in to post comments.