Simon Says Game Using a Touchpad and Joystick

Project Description

This project makes an electronic version of the classic game, Simon Says. The user will use a combination of the capacitive touchpad and the five directional switch for input, and they will see their output on the uLCD and hear it on the speaker with sounds provided by the sd card and from analog output. The game starts with instructions on how to play on the uLCD screen. The rules are largely the same as any other variation of electronic Simon Says with the exception that inputs must be held at certain points due to the nature of input read functions. The game will end once the player has reached the programmed end goal of 3 successful rounds. This means the player has matched Simon’s output three times. From there the game will start over, and will continue as long as the board is powered on.

To start, one must set up their breadboard like so. /media/uploads/adamlawrence/20160313_233920.jpg

Pinouts

SD Card

Device PortmBed pin
csp8
dip5
vccvout
sckp7
gndgnd
dop6
cdNo connection

Navigation switch (joystick)

Device portMbed pin
+No connection
Up17
Cp16
Lp15
Dp14
Rp13
-gnd

uLCD

Device portmBed
+5Vvu
Rxp27
Txp28
Gndgnd
Resp30

Touchpad

Device PortmBed
GNDgnd
SDAP9 (+4.6k resistor to vcc)
SCLP10 (+4.6k resistor to vcc)
IRQp26
VCCvout

Speaker

Device PortmBed
+Vu
Analog in (with resistor and transistor)p18

Full diagram shown below (taken from this page)

/media/uploads/adamlawrence/speaker_circuit.png

Video Demo

Code

The code sets up the navigational switch class, and the touchpad interrupt. After those and the rest of the item initializations, the code lays out the drawing functions for the grid, as well as all the possible shapes. After that, the main game loop begins. The instructions are displayed, then the game begins. Inputs are read in, then the game proceeds. At the end of the game, affirmative or negative sound effects will play from the sd card.

Input Instructions

The player inputs are as follows :

-green squares match the corresponding spot on the touchpad (in the orientation depicted in the picture above!)

-green arrows match the navigational switch direection (in the orientation depicted in the picture above!)

-green circles match the navigational switch "fire"/center button

To have the game properly register your input, hold down the navigational switch input or touch the touchpad section when the blue circle with the sequence number in the middle comes up on screen. Otherwise, the game will not recognize your input, and you will lose.

Import programSimonSays

Simon Says game using joystick and touchpad


Please log in to post comments.