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

/media/uploads/mhennessy3/1ulcd.png

mbeduLCD HeaderuLCD Cable
Vu 5V5V
GNDGNDGND
TX(P28)RXTX
RX(P27)TXRX
P30ResetReset

Table 1: mbed to uLCD connections

/media/uploads/mhennessy3/nav_switch.png

mbedNav Switch
Gnd-
P12U-up
P11C-center or fire
P10L-left
P9D-down
P8R-right
nc+

Table 2: mbed to navigation switch connections

/media/uploads/mhennessy3/microsd.png

mbedMicroSD
P8 (DigitalOut)CS
P5 (SPI mosi)DI
VoutVCC
P7 (SPI sclk)SCK
GndGND
P6 (SPI miso)DO
CDCD

Table 3: mbed to MicroSD connections

/media/uploads/mhennessy3/audio_amp.png /media/uploads/mhennessy3/speaker.png

mbedTPA2005D1Speaker
gnd pwr- (gnd), in -
Vout (3.3V) or 5Vpwr +
P18 (D/A)in +
out ++
out --
Any DigitalOut px(optional)S (low for shutdown)

Table 4: mbed to audio amp to speaker connections

/media/uploads/mhennessy3/cap1.jpg 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.