8 Ball Game

by 882343 in Circuits > Arduino

34 Views, 1 Favorites, 0 Comments

8 Ball Game

FVP0YMXM69NI37Q.jpg

Hi my name is Sahaj, and I welcome you to my Final Evaluation project of 8 ball game. The soul purpose of this game is to make the spinning wheel stop and start with an IR remote. You have to ask a question or make a statement such as I will pass or will I pass and then spin the wheel and stop it using an IR remote by clicking on the (+) button. There are 4 possibilities Yes, No, Maybe or Try again. Which ever one it lands on will be the answer. When you will spin it the light will flash red and when it will stop and show the answer the light will flash green. Now lets take a look at the materials will be used while executing the project.

Supplies

Image 1.jpeg
Image 2.jpeg
Image 3.jpeg
Image 4.jpeg
Image 5.jpeg
Image 6.jpeg
Image 7.jpeg
Image 8.jpeg
Image 9.jpeg

The supplies we will need are listed below:

- "Arduino Uno x1

- Seven Segment Display x1

- LED's (Red &Green) x 2

- Push Button x1

- Servo motor x1

- 4 Resistors ( three 330, and one 10K)

- IR Receiver & Remote x 1 (It's optional if you don't want it you can code it by just using push button "1 press = spin and 1 press = stop")

- Wires

and a bread board which will help keep the circuit visually pleasing and neat.

Assembling the Circuit

Image.jpeg
PHOTO-2025-01-23-14-41-09.jpeg
PHOTO-2025-01-23-14-41-09.jpeg

First, place the Arduino and breadboard on the table. Put the 7-segment display on the breadboard. Use jumper wires to connect the display to the Arduino. Make sure the wires are connected to the correct pins.

Next, add the buttons, LED's, and the resistors to the breadboard. Use wires to connect these parts to the Arduino. The buttons will control the circuit, and the LED will show if it's working. Then, connect a small motor (servo) to the circuit. Check all the connections carefully.

Once everything is ready, plug the Arduino into your computer with a USB cable and simply turn it on.

Code

// C++ code

//

#include <Servo.h>


int pos = 0;


Servo servo_A0;


void setup()

{

servo_A0.attach(9, 500, 2500);

}


void loop()

{

// sweep the servo from 0 to 180 degrees in steps

// of 1 degrees

for (pos = 0; pos <= 180; pos += 1) {

// tell servo to go to position in variable 'pos'

servo_A0.write(pos);

// wait 15 ms for servo to reach the position

delay(15); // Wait for 15 millisecond(s)

}

for (pos = 180; pos >= 0; pos -= 1) {

// tell servo to go to position in variable 'pos'

servo_A0.write(pos);

// wait 15 ms for servo to reach the position

delay(15); // Wait for 15 millisecond(s)

}

}

Demo Video

This was done without and IR receiver and remote as mentioned above IR receiver and remote are optional but I have chosen to work with the push button so this is the push button.

Downloads