AutoRace

Overview

This is a simple game that we developed for our Mbed mini project. It uses an ARM Microcontroller (LPC 1768), a smart color LCD(uLCD-144-G2), a Phidget Mini Joystick and a speaker.

/media/uploads/srikard/img_20141021_131412.jpg Fig 1: Setup

The game is inspired by the popular handheld video game Auto Race. The player's car is represented by a green square at the bottom of the screen. The player must try and avoid the oncoming cars for as long as possible by swerving left or right using the joystick. The longer you stay the faster the other cars come at you!!!

The code for the game was developed in C++ using the mbed cloud compiler. We used the mbed’s Real Time Operating System (RTOS) to implement various threads that control the different components of the game. Mutex locks are used to access the shared resource (LCD) between the threads.

Connections

http://developer.mbed.org/media/uploads/4180_1/8185.png

mbeduLCD HeaderuLCD Cable
Vu5V5V
GNDGNDGND
TX(P9)RXTX
RX(P10)TXRX
P11ResetReset

Table 1: mbed to uLCD connections

http://www.phidgets.com/wiki/images/5/51/1113.jpg

mbedJoystick
VOUTRed
GNDBlack
Analog InWhite

Table 2: mbed to Joystick connections

The joystick sensor is essentially a 2-dimensional potentiometer creating a voltage divider on 2 axes. Each divider is supplied 3.3V from the mbed to create two nearly full scale analog inputs. The two required control signals for the Player's car, move left and right, were achieved by setting two threshold levels for each analog input.

Demo

Program

Import programAutoRacer

Complete Code

References


Please log in to post comments.