User manual

23
9t
h
Da
y
In the Advent calendar today
•1x RGB-LED with dropping resistor
RGB-LED
s
A
normal LED is alwa
y
s lit in onl
y
one colour. The RGB-LEDs used in the
A
dvent calendar can be lit in di
ff
erent colours. Generally, three LEDs
with different colours are installed in a transparent housing here. Each
of these three LEDs has its own anode, throu
g
h which it is connected to
a GPIO pin. The cathode, which is connected to the ground line, is only
present once. Therefore, an RGB-LED has four connection wires
.
The connection wires o
f
the RGB-LEDs have di
ff
erent lengths to identi
f
y
t
h
em c
l
ear
l
y. In contrast to regu
l
ar LEDs, t
h
e cat
h
o
d
e is t
h
e
l
ongest wire
he
r
e.
R
G
B-LED
s
w
o
rk lik
e
t
hr
ee
in
d
ivi
dua
l LED
s
a
n
d
t
h
e
r
efo
r
e
a
l
so
n
eed
t
hr
ee
220-Ohm dropping resistors (red-red-brown). The RGB-LEDs in this Advent
ca
l
en
d
ar
h
ave t
h
em a
l
rea
d
y insta
ll
e
d
.
Changing the colour o
f
an RGB-LED with the Ap
p
Today, you will program an App to change the colour o
f
an RGB-LED.
Components: 1x
b
oar
d
, 1xRGB-LED wit
h
d
ropping resistor, 1xjumpe
r
The RGB-LED also alread
y
has its droppin
g
resistors inte
g
rated. The second le
g
(short le
g
) is the
cathode and must be connected to the
g
round
.
T
he
S
k
etch
f
o
r
the
I
o
T-
boa
r
d
The pro
g
ram for this da
y
is called
T
a
g
9.in
o
and located in director
y
Ta
g9
.
Th
e
S
k
etc
h r
eacts
to
f
ou
r
but
-
to
n
s
:
Connection pins of an RGB-LED
Circuit diagram
f
or an RGB-LED with 3 dropping resistors
if (Text.startsWith(“Red”) || Text.startsWith(“RED”) || Text.startsWith(“red”)){
rot()
;
} else if (Text.startsWith(“Blue”) || Text.startsWith(“BLUE”) || Text.startsWith(“blue”)){
blau()
;
} else if (Text.startsWith(“Green”)
||
Text.startsWith(“GREEN”)
||
Text.startsWith(“green”)){
gruen
();
} else if (Text.startsWith(“Off”)
||
Text.startsWith(“OFF”)
||
Text.startsWith(“off”))
{
aus()
;
}
9. Day
15007-3 Conrad Adventskalender Internet of Things 2017_en.indd 2315007-3 Conrad Adventskalender Internet of Things 2017_en.indd 23 13.08.2017 17:03:1013.08.2017 17:03:10