Page 111 - Programming the Photon Getting Started With the Internet of Things
P. 111
V = 3V3 / (10 K(10 K + 10 K)) = 3V3 * 0.5 = 1.65 V
out
Now what happens when we replace one of the resistors with a variable resistor such
as a photocell? In this case we will replace resistor R1 with a 200-K photocell. Whether
you choose to replace R1 or R2 and which value you choose will affect the overall scale
and precision of the output readings you receive. It’s always worth experimenting with
different configurations of resistor values until you find something that you are
comfortable using and you are certain that the results are adequate.
For this example we are going to wire up a photocell and use it to determine the color
of an RGB (red, green, blue) LED. Connect the circuit to your Photon as shown in Figure
5.9 and use the contents in Table 5.2.
Figure 5.9 Breadboard layout diagram for photocell voltage divider circuit.