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.
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
mbed | uLCD Header | uLCD Cable |
---|---|---|
Vu | 5V | 5V |
GND | GND | GND |
TX(P9) | RX | TX |
RX(P10) | TX | RX |
P11 | Reset | Reset |
Table 1: mbed to uLCD connections
mbed | Joystick |
---|---|
VOUT | Red |
GND | Black |
Analog In | White |
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.