Changing ADC channel in free running mode always reads garbage.

OK, free running mode does work but I can't see any real speed benefit when serial printing. After everything done here, and reading a lot of posts on the topic, I think that single conversion mode is easier to track. There may be some performance improvement if more of the ISR code was moved to the main loop.

Because I am reading a full sample before changing channels, there is an obvious lag between them when plotting the waveforms for a simple sine wave input. I don't think there will be much of a performance hit if I changed channels after every reading, but that's something I'll look into later.

In order to close this thread, the code works and is attached. It will eventually find it's way to my github repo, GitHub - alidaf/arduino: Teensy projects, but bear in mind it doesn't do much but print out the sampled inputs to the serial console. I'm also only using 8-bit mode to gain some speed and considering what I intend to do with it. It will eventually form the basis of some visual displays such as a spectrum analyser, VU meter or other mood type display on an LED strip so accuracy is not an issue. These projects will also appear at my github repo once they are done. I'm sure that plenty of improvements can be made but it's there for anyone to improve on.

For free running mode change:

ADCSRA = B10001011; to ADCSRA = B10101011;

and remove

startADC(); from the ISR.

ADC_tests.ino (8.5 KB)