Changes

Classes/2010/VIS147A/Lab8

280 bytes added, 15:15, 2 March 2010
Activities
Open the example ''File->Sketchbook->Analog->AnalogInput''. In this example, the value of the analog input changes the timing of the light: the lower the input voltage the more quickly the light blinks, the higher the input voltage the slow the light blinks.
==== Potentiometer ====First we will use a potentiometer as our input.
[[Image:Pot_in.png]] [[Image:Pot_photo.JPG|400px]]
<code>sensorPin</code> The simple potentiometer voltage divider can be any connected to an of the Analog In pins (0-5) on your Arduino. By default, the ''AnalogPinput'' code expects the potentiometer to be connected on Analog In 0, the value of <code>sensorPin</code> variable at the top of the program.
QUESTION: What will the voltage at the analog input be? What are the upper ____ and lower ____ values as you turn the knob? (HINT: this is a voltage divider. How do you calculate the voltage in a voltage divider?)
*Q1==== Photoresistor ====[[Image:Photo_resistor.1: What will the voltage at A_IN be? What are the upper and lower values? (HINTpng]] [[Image: it is a voltage dividerPhotoresistor. How do you calculate the voltage in a voltage divider?)JPG|400px]]
=== photoresistor ===[[Image:Photo_resistor.png]] [[Image:Photoresistor.JPG|400px]] Take the photoresistor from your 147A kit, which has a resistance between 140k 800 Ohms - 800 140 KOhms depending on your lighting conditions.
*Q2.1: With the same R2 resistor (10k) from above, replacing R1 with the photoresistor, what range of voltages (and corresponding data values) would you expect to see at your A_IN pin?