The Halloween Boom Game

With this project, we wanted to recreate the TV Reality Show "Boom". This game consists of a series of questions with 4 possible answers which just one of them, is the correct. To deactivate the boom, you have to only cut the wires that contain the wrong answers, when cutting the correct one, the boom explodes. The following code is a wire combination of just one question.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Materials

Step 2: Set Wires As Buttons

In order to understand how to connect the wires as buttons, use the example from the library "Buttons". Follow the steps connecting a button and then change it with a wire on its position. In the following images is represented how the final prototype should be connected with buttons (first images) and wires (second image).

View video

Step 3: The Code

Copy the image bellow on the protoboard with all the components mentioned on the first step and then paste the code on your Arduino to run the program and... play the game!

View the video! It is a demonstration of the game.

Our code:

//configuration leds
//Question led const int ledquestion1 = A5 ; const int ledquestion2 = A4 ;

//Right or wrong led const int ledPinR = 10; const int ledPinV = 8;

// configuration wires

const int wireA = A1; const int wireB = A0; const int wireC = 12; const int wireD = 11;

//INITIAL STATES OF THE WIRES

int wireAState = 0; int wireBState = 0; int wireCState = 0; int wireDState = 0;

//servo #include Servo myservo; // create servo object to control a servo.

int val; // variable to run the servo.

void setup() {

// initialize the LED pin as an output: //Right or wrong led pinMode(ledPinV, OUTPUT); pinMode(ledPinR, OUTPUT); //Question led pinMode(ledquestion1, OUTPUT); pinMode(ledquestion2, OUTPUT);

// initialize the wire pin as an input: //wire pinMode(wireA, INPUT); pinMode(wireB, INPUT); pinMode(wireC, INPUT); pinMode(wireD, INPUT);

myservo.attach(9);

//We set the wires as buttons in order to recreate the action of pushing when desconecting the wire }

void loop() { // read the state of the pushbutton value:

//wires wireAState = digitalRead(wireA); wireBState = digitalRead(wireB); wireCState = digitalRead(wireC); wireDState = digitalRead(wireD);

if (wireAState == LOW) { . //If the wire is connected Every led is tured of except the one that indicates that the bom is connected. // turn LED on: digitalWrite(ledPinV, LOW); digitalWrite(ledPinR, LOW);

digitalWrite(ledquestion1, HIGH); digitalWrite(ledquestion2, LOW);

val = map(val, 0, 1023, 0, 180); // Because we don't want any action, when everything is connect. Srevo 0 degrees. myservo.write(0);

} else { //In case the wire is disconnected turn on the red light digitalWrite(ledPinV, LOW); digitalWrite(ledPinR, HIGH);

digitalWrite(ledquestion1, LOW); digitalWrite(ledquestion2, LOW);

val = map(val, 0, 1023, 0, 180); myservo.write(180); delay(15); // In this particular case, we defined the A wire as the correct question so, the one we shoudn't disconnect. Due to that, //we activate the punishmet turning on the servo.

}

//The following cases are similar to the first one. When the wire is connected anything except the mentioned led before is turned of. When disconnected, //Because we already have setted the correct questions, the following ones ture on the green led. That inticates that you can still play the game. if (wireBState == LOW) { // turn LED on: digitalWrite(ledPinV, LOW); digitalWrite(ledPinR, LOW);

digitalWrite(ledquestion1, LOW); digitalWrite(ledquestion2, LOW);

val = map(val, 0, 1023, 0, 180); myservo.write(0);

} else { // turn LED off: digitalWrite(ledPinV, HIGH); digitalWrite(ledPinR, LOW);

digitalWrite(ledquestion1, LOW); digitalWrite(ledquestion2, LOW);

val = map(val, 0, 1023, 0, 180); myservo.write(0); } if (wireCState == LOW) { // turn LED on: digitalWrite(ledPinV, LOW); digitalWrite(ledPinR, LOW);

digitalWrite(ledquestion1, LOW); digitalWrite(ledquestion2, LOW);

val = map(val, 0, 1023, 0, 180); myservo.write(0);

} else { // turn LED off: digitalWrite(ledPinV, HIGH); digitalWrite(ledPinR, LOW);

digitalWrite(ledquestion1, LOW); digitalWrite(ledquestion2, LOW);

val = map(val, 0, 1023, 0, 180); myservo.write(0); // waits for the servo to get there } if (wireDState == LOW) { // turn LED on: digitalWrite(ledPinV, LOW); digitalWrite(ledPinR, LOW);

digitalWrite(ledquestion1, LOW); digitalWrite(ledquestion2, LOW);

val = map(val, 0, 1023, 0, 180); myservo.write(0);

} else { // turn LED off: digitalWrite(ledPinV, HIGH); digitalWrite(ledPinR, LOW);

digitalWrite(ledquestion1, LOW); digitalWrite(ledquestion2, LOW);

val = map(val, 0, 1023, 0, 180); myservo.write(0);

}

// This last one case, indicates that: if all the incorrect answers are disconnected (the ones that turn on the green light), // the other led turns on indicating that the bomb is desactivated if (wireAState == LOW && wireBState == HIGH && wireCState == HIGH && wireDState == HIGH) { digitalWrite(ledquestion1, LOW); digitalWrite(ledquestion2, HIGH); }

}

Step 4: Conclusions

The challenge of this project was to set simple wires as buttons and make Arduino recognize them like it. Surprisingly it was easier than expected because we just needed to display the wires as the buttons: One end connected to electricity and resistance, and the other end to the ground.

We didn't want the answers to be random because we needed to know which one was the correct answer, so we tried to set other buttons to configure different options (questions) to the wires. We explored how to program that but we saw that we required the function "switch case" and we hadn't had the time to experiment and understand the function to achieve our objective.

Step 5:

Be the First to Share

    Recommendations

    • Instrument Contest

      Instrument Contest
    • Make it Glow Contest

      Make it Glow Contest
    • STEM Contest

      STEM Contest

    Discussions