Assignment: DC Motor: Actuation Assignment 1
Collaborators: mcozzi
Description:
For this assignment, I wanted to explore a playful version of rock-paper-scissors. The user is able to control the spinner/pointer and turn off the pot when they are ready to throw a "rock, paper or scissors". Depending on where the spinner stops, the user knows if he has won, lost or tied. I conciously chose to use the K'nex to help convey the fun, color and playfull aspects of the game.
Components:
DC Motor
potentiometer
2 AA batteries
sheet of paper with wheel design printed
K'nex (lots and lots of them)
Arduino board
Bread board
Arduino:
I used the PotControlsMotor program:
/*
* 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
}