Description
For this lab, I decided to utilize the DC motor to twirl a ballerina cut out. I used a potentiometer to control the rate of her spinning.
I created the ballerina using cardboard and tape, and her spin platform using paper cups and a wine bottle cork.
Watch the video below:
https://vimeo.com/77567866
Components
1- Arduino Uno
1- Breadboard
1- USB cable
3- Jumper wires
1- 1K Ohm resistor
1- 3 V battery
1- Potentiometer
1- DC Motor
1- Diode (1N4004)
1- Transistor (TIP120)
+ cardboard, paper cups, string, cork, and tape for the ballerina
Code
/* Kristina Hart Lab 6
Twirling Ballerina
*/
int potPin = 0; //select input pin for potentiometer
int motorPin = 9; //select pin for motor
int val = 0; //variable to store value coming from the sensor
void setup() {
Serial.begin(9600);
}
void loop() {
val = analogRead(potPin); //read value from sensor, between 0- 1024
Serial.println(val);
analogWrite(motorPin, val/10); //analogWrite can be between 0-255
}
- Login to post comments