5,710
edits
Changes
→Analog Input driving Analog Output
[[Image:MOTOR_SPEED.JPG|400px]]
Combing your ''AnalogInput'' and ''Fading'' code to drive the fading/speed-control circuit with the potentiometer.
Use <code>analogRead()</code> to get the value from the sensor, like you did before, then use <code>analogWrite()</code> to output the value to the LED. NOTE: <code>analogRead()</code> will return values from 0-1023, and <code>analogWrite()</code> writes values from 0 to 255, so you will need to divide your read value by 4 to get the output value. Or you could use <code>map()</code>.
==== Potentiometer driving Motor ==== ==== Photoresistor driving Motor =Lightbulb ====
Drive this circuit with the input from the photoresistor. Does yours motor turn on when it is light, or does it turn off? Switch this to the opposite behavior by rewriting the code running on the processor.
==== Photoresistor driving Motor ====
===Actuators, for future reference===