I use a formula for this to have a nice fade in/out effect that also takes care of the non linearity of the brightness of a led while fading in a linear way.
by slowing the process down i have also a wakeuplight for the winter.
I would like to move this to an esp8266 or esp32.
How would this work in rules? I can not do the syntax right....
Code: Select all
value = (exp(sin((x - 1000) / 2000.0 * PI)) - 0.36787944) * 108.0;
value2 = (int) value;
analogWrite(pulsepin, value2);