Add light sensor to Wise Clock 4
This is long overdue. As we know, the display brightness on Wise Clock 4 can be changed between 5 levels, by pressing the "Plus" button. To adjust the brightness automatically, based on the light conditions, we need to add a light-sensitive sensor of some sort, and the most common is the LDR (light-dependent resistor). Any of the countless articles and tutorials on Arduino + LDR will teach how to connect the LDR to an analog pin, using a voltage divider. For Wise Clock 4 , the LDR is connected between A0 (pin 40 of the processor) and ground, with a 10k resistor between A0 and Vcc, as shown below: GND|----[ LDR ]---A0---[10k resistor]----+Vcc The automatic brightness adjustment is enabled in software with this macro (in file UserConf.h ): // use an LDR (connected to A0) to automatically adjust // (every 5 seconds) screen brightness to ambient light; #define AUTO_BRIGHTNESS and implemented in this new function: void WiseClock::checkBrightness() { #ifdef AUTO_BRIGHTNESS ...