Short answer: The Xiao does NOT have/enable built in pull-up resistors.
Long answer: After noticing some odd behavior while shrinking circuit that works fine on an UNO, I did some digging, and then ended up searching online and finding this thread… The code compiles just fine with the INPUT_PULLUP specified, but does not actually do what is expected.
So I tested my 3 Xiao units bare (i.e only the USB connected) with the following sketch:
void setup() { Serial.begin(9600); for (int i = 0; i < 11; i++) pinMode(i, INPUT); } void loop() { for (int i = 0; i < 11; i++) Serial.printf("%c:%i ", (char)(i + 65), analogRead(i)); Serial.println(); delay(100); }
Then again, but this time replaced pinMode(i, INPUT);
with pinMode(i, INPUT_PULLUP);
Using the Arduino IDE ‘Serial Plotter’ I got the following charts:
Running a similar test on an Uno/Nano output consistent values at 1023 on all analog pins when INPUT_PULLUP
was used (except A6 and A7 on the Nano, which dipped a bit, but still over 1000).
I guess I will be adding some external pullups to my Xiao circuits.
[Mac OS 10.14.6 / Arduino IDE 1.8.13 / Seeed SAMD Boards 1.8.1]