The Saw Game

Team:
Ashwini Sukhdeve,
Manisha Iyer,
Shilpi Seth,
Sushmita k,
Swati Asthana

After the first 2 days we understood and learned usage of arduino, bred board and different sensors, we had to now do a small 1 day project using the concepts and sensors.
Objective:
Make a small Interactive game using sensors and arduino.
Project:
We build a new game ’Saver or Chopper’ which is very challenging, also involves a lot of risk. This game has got an Axe hanging on the top oscillating equally both the sides at angle of 120.
And there is cute toy kept inside the box, the player had to take the risk and get the toy from inside, but as the player tries to come to pick up the top, axe starts oscillating at a very high speed.
Products used:
1. Switches , wires
2. Arduino and bred board
3. Proximity sensor
4. Server Motor

Final look of game:
Play:
The Program:

#include <Servo.h>
Servo myservo; // create servo object to control a servo
// a maximum of eight servo objects can be created
float pos = 0;
int sensorValue;
int sensorPin = A0;
int val;
const int buttonPin = 2;
int buttonState = 0;
void setup() {
pinMode(sensorPin, INPUT);
pinMode(buttonPin, INPUT);
myservo.attach(9);
Serial.begin(9600);
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
val = map(sensorValue, 0, 1023, 1, 8);
}
void loop()
{ buttonState = digitalRead(buttonPin);
// check if the pushbutton is pressed.
// if it is, the buttonState is HIGH:
if (buttonState == HIGH)
{
for(pos = 30; pos < 120; pos += val) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
myservo.write(pos); // tell servo to go to position in variable 'pos'
delay(15); // waits 15ms for the servo to reach the position
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
val = map(sensorValue, 0, 1023, 1, 8);
}
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License