Lab 6
By Victor Tjhia
Description
Using DC Motor rotating movement, I created a simple fan only using eraser and paper. I also add LED light that turns on when fan is spinning.
Components Used
· 1 Light Emitting Diode (LED) RGB
· Resistor
· Arduino
· Solderless Board
· Eraser
· Paper
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 = 12; // select the pin for the Motor
int ledPin = 7;
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
analogWrite(ledPin, val/4);
}