STEVAL-ILL009V1 reference board
AN2531
28/40
number coming from ADC (potentiometer P1) has range from 0 to 252. This range is divided
to six segments where always just one color is changed and two are constant (ON or OFF).
Blue color is set if the potentiometer is in the left side (0 from ADC), because B = ON (blue),
R = OFF (red) and G = OFF (green). If the value from ADC is increased to 42, the PWM of
green color is decreased. In case ADC has value 42 the green is fully turned ON together
with blue and red is OFF. The ADC value from 43 to 84 increases blue color (light is going
down) and if ADC has value 84 only green LED is ON. In this way it is possible to move light
through all basic colors. MODE 5 represents automatic color changing. The principle of the
automatic color change is similar to manual color control, because the color level is not
adjusted by potentiometer P1 (0-252), but automatically using the 156 µs time base
generated by the auto-reload timer.
Note:
In order to demonstrate the best lighting effects, the application automatically starts in
MODE 5 - automatic color changing mode.
Figure 17.
Blink function flowchart - second part
AM00298
4
3
2
3
Set bright
PWM on OE pin
Mode changed
MODE 1
MODE 2
Y
N
Y
N
Y
N
Y
N
Y
N
Y
N
Set starting
conditions
MODE 3
MODE 4
MODE 5
Set RED bright
Set DATA_blink1
Set DATA_blink2
Set GREEN bright
Set DATA_blink1
Set DATA_blink2
Set BLUE bright
Set DATA_blink1
Set DATA_blink2
Set DATA_blink1
Set DATA_blink2
Set manual color
Set auto color
Startup = ON
Set DATA_blink1
Set DATA_blink2
Overtemperature