-
-
Notifications
You must be signed in to change notification settings - Fork 737
Closed
Description
Consider the following sketch:
#define Debug Serial
void setup() {
analogReadResolution(12);
pinMode(A0, INPUT);
Debug.begin(9600);
while (!Debug);
}
void loop() {
int a = analogRead(A0);
float v = 3.3*((float)a)/4095;
Debug.print(a);
Debug.print(" ");
Debug.print(v,3);
Debug.println();
delay(1000);
}
If you provide a voltage on pin A0, then results in v are typically offset by +35mV (sometimes a little less, sometimes a little more).
There is likely a bug in the Arduino code of the analogRead() function, as detailed here:
https://www.omzlo.com/articles/your-arduino-samd21-adc-is-wrong-did-you-notice
sabas1080, MartyMacGyver, tuxedo0801 and werediverhjmhardsoft
Metadata
Metadata
Assignees
Labels
No labels