User manual
1
5
7t
h
Da
y
In the Advent calendar today
•1x potentiometer, 15kOhm
Controllable running ligh
t
Toda
y
’s pro
j
ect is a runnin
g
li
g
ht the speed o
f
which can be
controlled with a potentiometer.
C
omponents: 1x board, 1xLED green with dropping resi
-
stor, 1xLED yellow with dropping resistor, 1xLED red with
dropping resistor, 1x15-kOhm-potentiometer, 4x jumper
(different lengths
)
T
h
e progra
m
The program
f
or this day is called
T
ag07.
i
n
o
an
d
l
ocate
d
in
d
irectory
T
ag0
7
.
i
nt analogP
i
n = A5
;
i
nt analogValue
;
i
nt led1 = 8;
i
nt led2 = 6
;
i
nt led3 = 4;
v
oid setup()
{
pinMode
(
analogPin, INPUT
);
pinMode(led1
,
OUTPUT)
;
pinMode
(
led2, OUTPUT
)
;
pinMode
(
led3, OUTPUT
)
;
digitalWrite(led1, LOW);
digitalWrite
(
led2, LOW
)
;
digitalWrite
(
led3, LOW
)
;
Serial.be
g
in
(
9600
)
;
}
v
oid loo
p
() {
analogValue = analogRead
(
analogPin
)
;
Serial.println(analo
g
Value)
;
delay
(
analogValue
);
di
g
italWrite(led3, LOW);
di
g
italWrite(led1, HIGH)
;
delay(analo
g
Value)
;
di
g
italWrite(led1, LOW);
digitalWrite
(
led2, HIGH
);
delay(analo
g
Value)
;
digitalWrite
(
led2, LOW
)
;
di
g
italWrite(led3, HIGH);
}
How the pro
g
ram work
s
analo
g
Value = analo
g
Read(analo
g
Pin);
delay(analo
g
Value)
;
digitalWrite
(
led3, LOW
)
;
di
g
italWrite(led1, HIGH)
;
The temporary variable analo
g
Pin is used to read the value set for the
p
otentiometer. dela
y
i
s
used
to
wait and then switch the LEDs.
The potentiometer takes up some space. There
f
ore, the IoT-board must be pushed up higher
than on the day be
f
ore. LEDs
f
rom the le
f
t to the right: green, yellow and red
.
7. Day
15007-3 Conrad Adventskalender Internet of Things 2017_en.indd 1515007-3 Conrad Adventskalender Internet of Things 2017_en.indd 15 13.08.2017 17:03:0513.08.2017 17:03:05










