Isn't it possible to set the ADC in free running mode, and then just read the register when you need it? That way the conversions should happen in the background, not affecting the sketch itself.
Alternatively: instead of the for loop set a timer interrupt that at fixed intervals calls a function that sets the pin patterns. That should also do the job of getting a more regular output pattern.
wvmarle:
Isn't it possible to set the ADC in free running mode, and then just read the register when you need it?
Maybe. (That contraction at the front of your sentence makes a definitive answer awkward.)
Yes, it is possible to set the ADC in free running mode then just read the current value at will. I recall it is not particularly difficult (i.e. set a bit or two then fire it up). It is also not troublesome when dealing with a single channel.
[quote author=Coding Badly link=msg=3920743 date=1540543456]
Maybe. (That contraction at the front of your sentence makes a definitive answer awkward.)[/quote]
That's because I wasn't sure myself - heard about the option (make it do conversions all the time - can also trigger an interrupt when a conversion is done), never used it.