Dear All,
I found this article about ADC reading error (mainly offset): https://www.omzlo.com/articles/your-ard ... you-notice
I tried the two sketches on my adafruit Metro 0 Express when I connect the A0 (or any other analog input) to GND and found an offset of 40 count withe the analog read and 20 with the one that implement the While (second sketch in the above article).
On Bugfix - waiting for first ADC read to complete after ADC enable. by aentinger · Pull Request #447 · arduino/ArduinoCore-samd · GitHub it show that it is a bug and it is solved by adding indeed a While in the wiring_analog.c lib.
My stupid question is: how do I implement this in the ide lib? Is adafruit lib already updated? I did update my arduino ide adafruit library and Samd21 but I have the same issue. Anyone can help locate the analog lib with Adafruit board?
PS I tried to add a dummy reading in my sketch before the actual reading but the count offset is always at 40 and drop to 20 only with the second code mentioned in the article above.
Thank you.
Gianluca.