Here is the circuit (Arduino Due, 1kΩ resistor, LED):
Note how I bring the ground from the Arduino board to the breadboard, and also connect the ADC pin to the gnd rail on the breadboard.
Here is the code:
void setup() {
Serial.begin(9600);
#define ADC_FREQ_MAX 250000
Serial.println(ADC_FREQ_MAX);
}
void loop() {
analogReadResolution(12);
Serial.print(analogRead(0));
Serial.print('\n');
}
Here is what I do:
- 600cs: I unplug the LED.
- 4000cs: I plug in the LED.
- 6500cs: I unplug the LED.
- 7750cs: I plug in the LED.
Here is the result:
I plug this same setup into an Uno, and I get no issue:
Why is ground voltage non-zero, and why does it increase when I plug in an LED? What issue with the Due could cause this?