Writing / Dev Logs
Dev LogKaroKorry19.10.2026

Your eyes are not linear

The first firmware covered the basics. The switch is debounced (it only believes a new state after seeing it steadily for about 20 ms) and presses are counted, so a quick double tap is never lost. Each LED colour gets its own hardware PWM channel. The LEDs turn on when the pin goes low, which is backwards, so I made the timer invert its own output and the rest of the code never has to know.

Then I tried a smooth fade, and it looked wrong: the light jumped up fast and then seemed stuck at full brightness for most of the range. The code was fine. Our eyes are far more sensitive to changes in dim light than in bright light, so half the power looks much brighter than "half". A small gamma-correction table bends the curve back, and now a fade looks like a fade.

On top of that each half can glow steadily, blink hard or slowly pulse, all handled by the button itself. The controller says "amber, pulse" once and moves on.

embedded