Mine Field Game with Thumb Joystick

Components used:

  • Thumb Joystick
  • SD Card
  • Speaker
  • uLCD

For this lab we have created a mine field game using thumb joystick to control movements of the player. Speaker, SD card, and uLCD was used for audio and visual effects.

Thumb Heading

/media/uploads/evgeniy/joystick_feCG3xz.jpg

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

VERT is used to control vertical direction and HORZ is used to control horizontal direction. VCC and GND connections are for power. SEL is not used in this demo.

Speaker

Follow the link on how to setup a speaker. In our demo the speaker connected to pin 18.

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

SD Card

Follow the link to setup your SD card.

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

uLCD

Follow the link to setup your screen.

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

Code for Mine Field

Import program4180_Lab4

Mine Field Game

Video Demo

As you can see in the video on the first try we purposely step on the mine to lose and "You lose!". Second time around we avoid all of the mines in three rounds. and after we win sound of applause is played by the speaker and "You won!" is appeared on the screen. The mines are seen on the screen but they can be disabled by commenting out "#define MINE" in the beginning of the main.cpp code;

main.cpp

#define MINE


Please log in to post comments.