Another idea. A small solar cell connected via ADC to measure voltage. Might be a speed problem though. But the dim/bright settings would be controlled in the code.