loading

This game is easy to program,prepare and play!you can even learn how to play in seconds game requires no more than some push buttons of any kind (bring one for each player), Led's according to the number of push buttons (one each) and some jumper wires and 2.2k ohms or 10k ohms(you will find all the ingredients required in the diagram above). The idea of the game is that all players have to tap on the push button as fast as they can and if they pres on the button every 0.3 seconds it will be displayed as 1(exp. player1: 1 or player1: 0) and if they dont't it will be displayed on the computer for each player .

Step 1: Step 1:parts Assembly

First assemble the board. Connect the leds and the push buttons to the digital pins and rest of the assembly is shown in the image above. It should take you a couple of minutes to assemble it if you're a beginner,intermediate or advanced programmer.

Step 2: Step 2:The Code

The code might be a little hard for beginner and even for some intermediate programmers; copy the code which is : const int led=13;

const int push=2;

const int push2=1;

const int led2=12;

int val;

int val2;

void setup() {

pinMode(led,OUTPUT);

pinMode(push,INPUT);

pinMode(push2,INPUT);

pinMode(led2,OUTPUT);

Serial.begin(9600); }

void loop() {

delay(300);

val=digitalRead(push);

if (val==HIGH) {

digitalWrite(led,HIGH);

Serial.println("player1:1");

} else if(val==LOW) {

digitalWrite(led,LOW);

Serial.println("player1:0");}

val2=digitalRead(push2);

if (val2==HIGH) {

digitalWrite(led2,HIGH);

Serial.println("player2:1"); }

else if(val2==LOW) {

digitalWrite(led2,LOW);

Serial.println("player2:0");} }

When you finish copying the code upload it on the arduino board and click ont the serial monitor button which is located on the top right of the screen.

ps: don't forget to change the pin no.s if have changed them in the assembly

Step 3: Step 3(final Step):results

After you finish uploading the code and open the serial monitor (if it doesn't open at once try again) you will see that if the player for example player2 presses the button it will display 1 on the computer otherwise it will display 0.

Step 4: Thank You for Reading My Instructable! :)

Thank you for viewing my instructable and i wish that you like it and enjoy playing with it.If you have any recommendations for me or suggestion for coming instuctables please feel free to leave them at the comments section !

About This Instructable

471views

6favorites

License:

More by yusuf maged:Arduino:quick and Easy Arduino Game/puzzle for Intermediate Programmers 
Add instructable to: