Changes

Classes/2010/VIS147A/Lab8

447 bytes added, 15:09, 2 March 2010
no edit summary
== Lab 8 - Analog Input /Output, PWM ==* File->Sketchbook->Analog->AnalogInput
The == Topics ==* Analog input to Arduino. * Analog output from Arduino. * PWM and motor speed control. * 8 and 10 bit variables.* Arduino programming: ** <code> analogWrite()</code>** <code> analogRead()</code> == Materials ==* DC motor* TIP 120 Transistor* 1N4001 Diode* red LED* 220 Ohm resistor* hookup wire* 10K potentiometer* breadboard* fully assembled Freeduino == Activities ===== Analog Input ===Open the example ''File->Sketchbook->Analog->AnalogInput''. In this example, the value of the analog input signal changes the timing of the light: the lower the signal input voltage the lower more quickly the on-off frequencylight blinks, the higher the signal, input voltage the higher slow the frequencylight blinks. We can return to this at the end of the lab.
First we will use a potentiometer as our input.
=== Potentiometer ===
[[Image:Pot_in.png]]
A_IN [[Image:Pot_in.png]] [[Image:Pot_photo.JPG|400px]] <code>sensorPin</code> can be any of the Analog In pins (0-5) on your FreeduinoArduino.
[[Image:Pot_photo.JPG|400px]]
*Q1.1: What will the voltage at A_IN be? What are the upper and lower values? (HINT: it is a voltage divider. How do you calculate the voltage in a voltage divider?)