Data Sheet
Project 10
Project 8
Night Light
Build this circuit. Load sketch Night_Light into Snapino
using the programming instructions in project 3. Cover
the phototransistor (Q4) to turn on the red LED (D1).
Once programmed, you can use the 9V battery
connector to power the circuit instead of the USB
cable, then take the circuit with you into a dark room.
Programming Note:
analogRead(0) - this
command measures
the voltage at analog
pin A0 using a 10-bit
a n a l o g - t o - d i g i t a l
converter, and out-
puts a value from 0 to
1023 (representing a
voltage of 0V to 5V).
You can adjust the
sensitivity by chang-
ing 200 to be higher
or lower.
Use the preceding circuit, but load sketch
Blink_Rate into Snapino
TM
. The red LED (D1)
will be blinking; the darker the room, the faster
it blinks. If the room is very dark then the red
LED may appear to be on continuously.
Swap the locations of the 10KW (R4)
resistor and phototransistor (Q4). Now
brighter light makes the LED blink faster and
darkness makes it slower.
Project 9
Blink Rate
Use the preceding circuit, with the R4 and Q4
locations swapped (so Q4 connects to the 5-
snap wire). Load sketch Copy_Cat_Light into
Snapino
TM
. Place the circuit in a bright room, so
there is light on the phototransistor (Q4). Block
the light to the phototransistor with your hand;
when you uncover it then the red LED (D1) will
be on for as long as the phototransistor was
covered. Try this several times.
Copy Cat Light
Programming Note: This program uses a
counter to keep track of how long you cover
the phototransistor. The longer you cover it,
the higher the counter gets. Once the
phototransistor is uncovered, the LED will
turn on, and the program will start subtracting
from the counter. This can count backwards
until the counter is equal to zero, where it
would then turn the LED off.
-21-
SCSNAPINO_Manual_112816.qxp 12/30/16 2:00 PM Page 22










