I have two Xiao board and with boths I have problems.
I tried with both board all analogRead() examples, but with no success.
The pins are connected right, I checked that with an multimeter.
That is one of my test sketches:
#define ADC_GND_PIN A1
#define ADC_VCC_PIN 6
#define ADC_BITS 12 // The SAM D1 on Seeeduino XIAO has 12 bit ADC inputs
void setup() {
Serial.begin(115200);
while(!Serial);
Serial.println("\nReading Ground and VCC values with Analog Input");
analogReadResolution(ADC_BITS);
pinMode(ADC_GND_PIN, INPUT);
pinMode(ADC_VCC_PIN, INPUT);
}
int gndValue;
int vccValue;
void loop() {
gndValue = analogRead(ADC_GND_PIN);
delay(10);
vccValue = analogRead(ADC_VCC_PIN);
Serial.printf("ADC(GND) = %d, ADC(VCC) = %d\n", gndValue, vccValue);
delay(1500);
}
and the Serial output is:
ADC(GND) = 599, ADC(VCC) = 1376
ADC(GND) = 711, ADC(VCC) = 1258
ADC(GND) = 562, ADC(VCC) = 1416
ADC(GND) = 739, ADC(VCC) = 1230
ADC(GND) = 521, ADC(VCC) = 1449
ADC(GND) = 792, ADC(VCC) = 1182
.....
it looks like that the VCC and GND ist not connected, but that is the case .
I hope anyone can help me !?
Regards Matthias