dhenry:
samples = (5.0* analogRead(pin) * 100.0) / 1024.0;
Things like that utilize floating point math and floating point math is quite inefficient on an 8-bit mcu.
A simpler approach would be to use fixed point math.
No it is not a simpler approach it is an approach that runs faster.
We are dealing with a compiler here and simple projects. All those posts and you still haven't got the basic hang of this forum have you.