Rock, Paper, Scissors!

by sydneylinnn in Circuits > Arduino

149 Views, 1 Favorites, 0 Comments

Rock, Paper, Scissors!

IMG_2920.JPG

When people are playing rock paper scissors with friends, sometimes one of them will show their choice slower than the other one. So I decided to make one game that people can't cheat on. In this game, the 3 green LED lights are for one player, and the 3 red LED lights are for the other player. One player will get to hold on to one of the buttons and the other one will hold on to the other button. The choice will only show when the two buttons are pressed at the same time. The buzzer is used to remind the player when the two buttons are pressed and when the LEDs stop shining.

Prepare Materials

IMG_2910.JPG
IMG_2919.JPG

1. Breadboard

2. Arduino Leonardo

3. 3 green LED

4. 3 red LED

5. Two buttons

6. 7 resistors( 2.2 k ohm

7. One buzzer

8. Jumper wires

9. a box

Connect Wires

IMG_2910.JPG

1st green LED <-> D6

2nd green LED <-> D5

3rd green LED <-> D4

1st red LED <-> D3

2nd red LED <-> D2

3rd red LED <-> D1

button 1<-> D7

button 2<-> D10

buzzer<->D8

positive <-> 5V

negative <-> GND

Start Coding

截圖 2021-05-21 下午8.03.54.png
截圖 2021-05-21 下午8.04.00.png

The code in this game is similar to the original code from the project that I consult, but I've changed some parts of the code to improve this project. First, I add a delay 5 seconds code after the buzzer speaks. In this way, there will be 5 seconds vacant after the buzzer speaks, and the LEDs will stop shining for 5 seconds. Next, I fix the code so that the buzzer will speak. I change the code for digitalWrite(buzzer,HIGH) to tone(8, 440, 500).

Code link: https://create.arduino.cc/editor/sydneylinnnnn/2df6a817-2270-48b1-8032-df42bb3ad87f/preview

Make Cover

IMG_2915.JPG
IMG_2916.jpg
IMG_2918.JPG

First, take a box that you won't use again. Second, cut one circle on the top of the box for the buzzer, two on the side for buttons, and 6 small square beside the top circle for the LED lights.

Finish!

IMG_2920.JPG
arduino

After finish coding, upload the code to your Arduino Leonado. Put your device into the box that you just made. Stick some symbols that you want to represent rock, paper, and scissors on the box. Last, enjoy the game!