I'm using just about the simplest possible sketch to scan the pins:
Code: Select all
#define D0 0 // qt-py-esp32-s2: D0 / gpio0 is the built in button near the usb-C port.
#define A4 SDA
void setup() {
Serial.begin(115200);
while (!Serial) { delay(20); } // Wait for serial port to stabalize.
pinMode(D0, INPUT_PULLUP); // hardwired against ground, so must use pullup mode.
pinMode(A0, INPUT_PULLUP); // Seems to only work in pullup mode.
pinMode(A1, INPUT_PULLUP); // Works fine
pinMode(A2, INPUT_PULLUP); // Doesn't work at all, in either pullup or pulldown mode.
pinMode(A3, INPUT_PULLUP); // Doesn't work at all, in either pullup or pulldown mode.
pinMode(A4, INPUT_PULLUP); // Doesn't work at all, in either pullup or pulldown mode.
}
void loop() {
Serial.printf("d0=%d, a0=%d, a1=%d, a2=%d, a3=%d, a4=%d\n",
digitalRead(D0), digitalRead(A0), digitalRead(A1), digitalRead(A2), digitalRead(A3), digitalRead(A4));
delay(1000);
}
On the electrical side, I'm just using a plain qtpy-esp32-s2 with male headers carefully soldered, and a simple female-to-female jumper to connect either to 5v or gnd pin and whatever pad is being tested. I'm sure there's no physical problem with the board or my wires, because when I run a Circuit Python script that does exactly the same monitoring, everything works perfectly.
I'd love to use use Circuit Python and ditch Arduino completely, but my larger project needs deep sleep mode, which circ-py doesn't seem to have support for; at least not that I can find. It was when I couldn't get that larger project working that I came up with this extremely simplified version of the pin scanner, and found that even in this simple base-case, I can't get GPIO working for a number of the pins. :-(...
Any suggestions? Thanks!
- Ken