Night Light LED dimmer documentation and code are available at http://jerrykomor.com/Stuff/Arduino/Night Light. I made this as alternative to bet site night light. I'm using a ribbon type LED trip thats stuck to the mack of a head board which hids a bit between the carvings on head board and the control module is basically a PWM controlled with 3 buttons: Up, Down, and On/Of switching and IRL540 FET transistor driving the output
Operating principle. The Up / Down buttons step through brightness by adjusting PWD duty cycle. Back light LED on the board will also change in brightness and it will dim as main light gets darker or go off or brighter as the main LED is brighter. It will blink when PWM reaches 0% or 100% duty to indicate full scale. The On/Off has additional finction from the self explanitory on/off. When you shut the lights off with it, it will slowly brighten or bring main PWM to last state when it was shut down by the switch. When the PWM was brought to 0% with the down button, pressing On switch will bring PWM slowly to 100% there is secondary output provided through small signal NPN transistor like 2n2222 or 2n4401 to ground on the output port, however software routing has not been implemented to take adventage of it. T2 and R7 therefore can be omited. P2 provides interface for ICSP to the chip to have it reprogrammed with updated software.