Racing car project with LCD and Joystick

/media/uploads/deathernater/forza-horizon-3__13-06-16.jpg.x128.jpg

Introduction

In this project we created a racing car game with an analog joystick input to control the car's speed and direction. The SD card reader is used to store the sound file of the project which is output by the Class D speaker. The uLCD is used to display the game and the SD card slot behind the uLCD is used to store the picture of the loading and fail screen. As the game start, the car is travel at a speed which could be controlled by the user. The user will win the game by travel a certain distance and dodge some randomly generated obstacle. If the car hit any obstacle the game will display the losing screen.

Components used:

-Thumb Joystick

-SD Card Reader

-Class D Amplifier

-Speaker

-uLCD

We created a racing car game with the LCD display, Class D Speaker, SD card reader, and thumb joystick.

Thumb Joystick

Joystickmbed
VCCp 40 - Vout
VERTp 15
HORZp 16
SELnot using
GNDp 1 - GND

SD Card Reader

The following table is the pin diagram for the SD card Reader

MicroSD BreakoutMbed
CS8 (DigitalOut cs)
DI5 (SPI mosi)
VCCVOUT
SCK7 (SPI sclk)
GNDGND
DO6 (SPI miso)
CDNot connect

For more reference please visit this page:

https://developer.mbed.org/cookbook/SD-Card-File-System

Class D Speaker

Following is the pin diagram for the Class D Speaker

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

For more reference please visit this page:

https://developer.mbed.org/users/4180_1/notebook/using-a-speaker-for-audio-output/

uLCD

/media/uploads/deathernater/ulcdpins.jpg

Following is the pin diagram for the uLCD display:

mbeduLCD HeaderuLCD cable
5V=VU5V5Vv
GndGndGnd
TX=P13RXTX
RX=P14TXRX
P11ResetReset

For more references of the LCD please visit this page:

https://developer.mbed.org/users/4180_1/notebook/ulcd-144-g2-128-by-128-color-lcd/

Code for the Racing Car Project

Import programECE4180Lab4

ECE 4180 Lab 4 Racing Game

Video Demo

In this video, we ran the project showing both the victory and defeat conditions.


Please log in to post comments.