Description
Explore motion as an output. I decided to make a new version of the classic Magic 8 Ball -- the Magic Toilet Roll! Ask the Magic Toilet Roll a yes/no question then press the button and find out the answer!
Components Used
1 1K Resistor
1 10K Resistor
1 Force Sensitive Resistor
1 DC Motor
cardboard box
sponge foam
toilet paper roll
Arduino 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 potPin = 0; // select the input pin for the potentiometer
int motorPin = 9; // select the pin for the Motor
int val = 0; // variable to store the value coming from the sensor
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(potPin); // read the value from the sensor, between 0 - 1024
Serial.println(val);
analogWrite(motorPin, val/4); // analogWrite can be between 0-255
}
Item
Magic Roll 1
Magic Roll 2
Comments
Comments from TAs
Cool idea, and good job getting it working so well! Once you start working with mechanical devices, it becomes difficult to get even simple interactions working, so I appreciate the effort. Now, if only the spinning would automatically stop with an answer "lined up" in the correct location. :) (I imagine that that would be a lot trickier to get working!)