Wheel of Fortune

Posted by karthik

karthik's picture

 

Objective

To control the DC motor and explore motion as an output.

Description

I wanted to use the motor and the ability to interact with it to have fun. The first idea that came to me was a wheel of fortune. 

The wheel spins away until the force sensor is hit. When hit, the force sensor causes the motor to stop and the pointer shows the number on the dial.

Code:

 

/*
 * one pot fades one motor
 * modified version of AnalogInput
 * by DojoDave <http://www.0j0.org>
 * http://www.arduino.cc/en/Tutorial/AnalogInput
 * Modified again by dave
 */
 
int fsrPin = 0;   // select the input pin for the force sensor
int motorPin = 9; // select the pin for the Motor
int val = 0;      // variable to store the value coming from the sensor
int stopped = 0;
void setup() {
  Serial.begin(9600);
}
void loop() {
 
  val = analogRead(fsrPin);    // read the value from the sensor, between 0 - 1024
  Serial.println(val);
  if(val > 500)
  {
    stopped = 1;
    analogWrite(motorPin,0); // stop motor
  }
  if(stopped == 0)
  {
    analogWrite(motorPin, 150); // analogWrite can be between 0-255
  }
}
 
What I actually want to do:
I want to fit the cardboard pointer with an LED, and place a photodiode on each number on the wheel. When the wheel stops, the light sensor with highest light measurement is going to be the one closest to the LED, and this can be an easy way of reading the number on the wheel.
Once the number is known, a variety of interesting things can be done like blinking an LED, playing a sound corresponding to the score etc.
Pic2
Pic1
0
Your rating: None
Tags: