Introduction - If you have any usage issues, please Google them yourself
For P16f887 (includes Hardware using Proteus). This is a code reading 3 internal ADC channels. Could be used with accelerometer. Plus it has a dimmer part which can be controlled by the ADC. Maybe not the best out there, but it worked for me.