This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
oak:tutorials:photocell [2016/03/22 21:45] jwhendy |
oak:tutorials:photocell [2016/03/22 22:00] (current) jwhendy resistor color code wrong |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ===== Oak: using a photocell (photoresistor) ===== | ===== Oak: using a photocell (photoresistor) ===== | ||
| - | In this lesson, we will connect a photoresistor to the Oak. A photoresistor is simply a potentiometer (a variable resistor) where light is acting to turn the knob. When there is a lot of light, the resistance drops; with low light, the resistance is higher. Using this property, we can send a voltage through a photoresistor, measure the resistance via a change in voltage, and obtain a value for how much light is shining on the photoresistor. | + | [[http://digistump.com/wiki/_media/oak/tutorials/photocell.png|{{http://digistump.com/wiki/_media/oak/tutorials/photocell.png?400}}]] |
| + | |||
| + | In this lesson, we will connect a photoresistor to the Oak. A photoresistor is like a potentiometer (a variable resistor) except light is acting instead of a knob. When there is a lot of light, the resistance drops; with low light, the resistance is higher. Using this property, we can send a voltage through a photoresistor, measure the resistance via a change in voltage, and obtain a value for how much light is shining on the photoresistor. | ||
| ===== Components ===== | ===== Components ===== | ||
| Line 10: | Line 12: | ||
| |Photocell|1| | | |Photocell|1| | | ||
| |Jumper wires|7| | | |Jumper wires|7| | | ||
| - | |Resistor, 10k ohm|1|Black-Brown-Orange| | + | |Resistor, 10k ohm|1|Brown-Black-Orange| |
| |3.3V USB UART or an Arduino*|1 | | | |3.3V USB UART or an Arduino*|1 | | | ||
| Line 115: | Line 117: | ||
| </code> | </code> | ||
| - | This code simply reads ''A0'', stores the number it obtain in the variable called ''light'', sends it ot the computer via serial, and then pauses for 0.25 seconds. | + | This code reads ''A0'', stores the number it obtain in the variable called ''light'', sends it ot the computer via serial, and then pauses for 0.25 seconds. |
| Using serial, the output will look like this as you cover and uncover the sensor: | Using serial, the output will look like this as you cover and uncover the sensor: | ||