Inaccurate analog reading and interrupt problem