//**********************************************************************
// 1. Connect a jumper wire to GND
// 2. Upload the sketch
// 3. Touch the jumper wire to any pin 2 through 12 and A0 through A5
// 4. The output will show the pin(s) you are touching
//
// The following shows pin D3 sensing ground through the jumper...
// 12 11 10 D9 D8 D7 D6 D5 D4 D3 D2 A0 A1 A2 A3 A4 A5
// 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1
//**********************************************************************
// I/O pins for the Uno/Nano, adjust for your board
int pin[] = {13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 14, 15, 16, 17, 18, 19};
int size = sizeof(pin) / sizeof(pin[0]);
void setup() {
Serial.begin(115200);
for (int i = 0; i < size; i++) {
pinMode(pin[i], INPUT_PULLUP); // pins held HIGH through internal 10k resistor
}
}
void loop() {
slowPins();
// fastPins();
}
void slowPins() {
Serial.println(F(" 13 12 11 10 D9 D8 | D7 D6 D5 D4 D3 D2 | A0 A1 A2 A3 A4 A5"));
for (int i = 0; i < size; i++) {
int state = digitalRead(pin[i]);
if (i == 6 || i == 12)
Serial.print(" | ");
else
Serial.print(" ");
Serial.print(state);
}
Serial.println();
delay(1000); // allow jumper to be moved before scrolling off the page
}
void fastPins() { // multi-probe logic levels
for (int i = 0; i < size; i++) {
int state = digitalRead(pin[i]);
if (i == 6 || i == 12)
Serial.print(" | ");
else
Serial.print(" ");
Serial.print(state);
}
Serial.println();
}