i haven't check your whole code and it's logic, but i'll suggest you to send the result of your ADC result to your PC to see what happen with your result.
You may need to do some averaging and/or use external filter to smooth your results, try to put a 0.1uF capacitor on each ADC input and see if it do something better.
If you have any, please post your schematic.




Bookmarks