Team: Ashwini, Manisha, Shilpi, Sushmita, Swati
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.
Components used:
1. Arduino duemilanove
3. Sharp Proximity sensor
4. Servo Motor
5. Switches , wires and bred board
Final look of game:
Play:
The Program:
#include <Servo.h>
Servo myservo;
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);
if (buttonState == HIGH)
{
for(pos = 30; pos < 120; pos += val)
{
myservo.write(pos);
delay(15);
sensorValue = analogRead(sensorPin);
Serial.println(sensorValue);
val = map(sensorValue, 0, 1023, 1, 8);
}