Description
To me this 7th lab was more an exercise in hardware creativity than in coding.
The moment I got the DC motor working in class I immediately thought of pinwheels, which I played often with as a kid. Pinwheels require some form of propulsion such as a child breathing on it or the wind. I thought about how neat it would be to have a motor powered pinwheel. I made a pinwheel out of origami paper and attached it to the DC motor. Using the same setup used in lab, the motor is powered by the battery pack and its speed controlled by the potentiometer.
Here's a video of my pinwheel in motion (https://docs.google.com/file/d/0B9s_t9tg0OGTYkFta2czYWVNYUk/edit?usp=sha...).
Components Used
1 - Arduino Uno
1 - Mini Breadboard
1 – 10 kΩ Resistor
1 – DC motor
1 – Potentiometer
1 – Transistor
1 – 1 kΩ Resistor
2 – origami paper
Code
Same code we used during lab
/*
* 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
Bigazzi Lab 7
*/
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
}
- Login to post comments