Rock Paper Scissors

Overview

This project implements a 2 player Rock Paper Scissors game on 2 mbed microcontrollers. The hardware components used in addition to the 2 mbeds are:

  • 2 uLCD-144 G2 128 by 128 Smart Color LCD display boards with serial interfaces
    • Purpose: To display:
      • The name of the game
      • Push button options
      • Prompt to begin game
      • Time left for each player to choose an option
      • Option to continue or end the game
  • 6 parallax push buttons (3 for each player)
    • Push button 1 represents ‘Rock’
    • Push button 2 represents ‘Paper’
    • Push button 3 represents ‘Scissors’
  • 2 Shiftbrite LEDs
    • Increases the intensity of light as player gets closer to running out of time
  • 2 SD card readers
    • To play a sound file every time a button is pressed and when the game ends
  • 2 speakers

How the game works

  • Both players are prompted to press a pushbutton of their choice in a time span of 5 seconds. [Note: If a player times out, they are given the option to try again]
  • Once a player pushes a button, it waits until the other player pushes a button as well.
  • Once both players choose an option, they are shown what option the other player chose, who won and what the current score is. They are then given an option to either continue the game or end it.
  • If both players choose to continue, the game starts again, keeping track of the previous score.
  • If one of the players chooses to end the game, the game ends with a display showing which player ultimately won.

Circuit Schematic

Note: The same circuit is constructed on 2 mbed boards

uLCD Color Display Board

MBEDuLCD HeaderuLCD Cable
5V = VU5V5V
GndGndGnd
TX = P28RXTX
RX = P27TXRX
P29ResetReset

Pushbuttons

MBEDPushbutton
P17Rock
P19Paper
P20Scissors

Note: Internal pullup implemented in the code

Speaker

/media/uploads/pkulkarni34/speaker_circuit_diagram.png

SD Card Reader

MBEDMicroSD
P8CS
P5DI
VOUTVCC
P7SCK
P6DO
GNDGND

ShiftBrite LED

MBEDShiftbrite
GndGnd
P11DI
P15L1
P16E1
P13C1
VU(5V)V+*

Direct Connection

MBED1MBED2
P9P10
P10P9

Code

Code for Player 1

Import programRPS-Player1

Code for Player 1 of Rock Paper Scissors Game

Code for Player 2

Import programRPS-Player2

Code for Player 2 of Rock Paper Scissors

YouTube Video

Display Snapshots

/media/uploads/pkulkarni34/1.jpg

/media/uploads/pkulkarni34/2.jpg

/media/uploads/pkulkarni34/3.jpg

/media/uploads/pkulkarni34/4.jpg

/media/uploads/pkulkarni34/5.jpg

/media/uploads/pkulkarni34/6.jpg

/media/uploads/pkulkarni34/7.jpg

/media/uploads/pkulkarni34/8.jpg

/media/uploads/pkulkarni34/9.jpg


Please log in to post comments.