ADC

Why is my code a complicated solution Robin2?

If you need a time critical sampling of measuring values, you can use a timer interrupt to take samples.
In a datalogger system you require to sample at fixed moments and to add a time stamp.