"A Surprise Reaction Game" - A0: Hello World

  By Christian Salvador

Final Prototype Image


Description

  The concept of this project builds on top of the required brief of Assignment 0. The two questions I initially asked were: "What if I used more than one LED?" and "What about more than one button?" I also experimented in using the shift register module to try and create a sort of bouncing light effect. I was then able to eventually come up with an idea.

  My first few computer science classes in high school involved using components, like buttons, and creating some sort of game with them. I remember being given two big buttons and using those as inputs while coding a sort of two-player trivia game in Java and so I decided to revisit the idea of a two-player game but simplified to use LEDs and a buzzer instead of a graphical interface.

  The concept of this game is very simple, two players compete with each other to press a button the moment a certain event happens. The first player to score three points would be considered the winner. However, no points will be given to anyone who presses the button too early and the round will reset.

  How this will work is I will use a combination of multiple LEDs, two buttons, a shift register module and a buzzer. The LEDs are arranged so that 3 red LEDs represent the Red player's points and 3 green LEDs represent the Green player's points. There is then a bright blue LED that will be what the players will need to react to. The LEDs that represent the points are all hooked up to a shift register just for efficient use of the Arduino's pins. Instead of hooking up 6 pins directly to the LEDs, 3 pins are hooked into the shift register while the LEDs are then hooked up onto the shift register. By using bitwise operators, I am able to control which LEDs light up as the shift register has 8 output pins I can use by outputting a byte where each bit represents a pin. In combination with the LEDs, I experimented with the buzzer while figuring out how to implement the LEDS. I decided to add the buzzer that plays different tunes and sound cues depending on the game state, something that I was inspired after seeing the Final Fantasy Victory Fanfare tune converted to frequencies. When the game starts counting down, I converted the musical notes of the "Jack in the Box" tune into frequencies and delays myself, as well as a sad trombone for failing. The Victory Fanfare tune is used whenever someone successfully reacts first. With all these components combined, I was able to create a game that utilizes LEDs to represent score and countdown, as well as the buzzer to represent the countdown as well, but also failure and success without needing a graphical interface to do this.


Concept Development Images

Initial Sketch

Initial Sketch with Buzzer

Internal Prototype


Concept Development Videos

Bouncing Lights Using Shift Register

Jack In The Box Tune and Victory Fanfare (SOUND WARNING)


Demo Video

Demo Video


Circuit Schematic Diagram


Arduino Code

Github Repo With Arduino Code (https://github.com/KittenInAMitten/CPSC599.88-A0)


References

  1. Final Fantasy Victory Fanfare Tune - reply to a comment by @PinchieMcPinch from https://www.youtube.com/watch?v=iY98jcuKh5E
  2. Musical Notes to Frequencies - https://pages.mtu.edu/~suits/notefreqs.html
  3. Jack in the Box Tune - https://musescore.com/dakook_music/jack-in-the-box
  4. Sad Trombone Tune - https://www.youtube.com/watch?v=6-R-sIh1azY
  5. Shift Register Documentation - https://docs.arduino.cc/tutorials/communication/guide-to-shift-out/