User manual
38
21st Day
In the Advent calendar toda
y
•1x photo transisto
r
•1x resistor 1kOhm
M
easuring brightness and darkness in the Ap
p
Now you have another sensor
f
or your projects. You can use
t
he photo transistor to display brightness and darkness. You
will learn how to today. You can use this knowledge to build
a light barrier, which will give you an alarm system with a dis
-
p
l
ay in an App.
C
om
p
onents
:
1x board, 1x
p
hoto transistor, 1xresistor
1
kOhm, 3xjumper (different lengths)
Th
e S
k
etc
h
T
he program
f
or this day is Tag21.in
o
and located in directory
T
ag21. The sketch is similar to the sketch
f
rom the previous day.
I
f
you want to see more values on your Smartphone, you must
reduce the waiting duration when calling
d
e
l
a
y
.
void loop
()
{
sensorValue = analogRead
(
sensorPin
);
HC05.print(“Phototransistor value = “)
;
HC05.println
(
sensorValue
);
delay
(
2000
);
}
T
h
e Ap
p
The texts are displayed using the App
Se
ri
a
l Bl
uetoot
h T
e
rmin
al
. First, connect to the IoT-board. You will
see the phototransistor value then. Look at how the values change in light and darkness.
2
1. Da
y
The setup is similar to that o
f
day 20. Caution: You are using a di
ff
erent resistor and the con-
nection with VCC (+5V) is im
p
ortant
.
15007-3 Conrad Adventskalender Internet of Things 2017_en.indd 3815007-3 Conrad Adventskalender Internet of Things 2017_en.indd 38 13.08.2017 17:03:2013.08.2017 17:03:20










