Here some code to test 13 button wired up as I posted
const int keyMin = 0; // Keymin, discovered through experiment
const int keyMax = 1023; // keymax, discovered through experiment
void setup() {
Serial.begin(9600);
}
void loop() {
// read the sensor:
int key = analogRead(A0);
// map the sensor range to a range of four options:
int keyValue = map(key, keyMin, keyMax, 0, 3);
// do something different depending on the
// range value:
switch (keyValue) {
case 0: // your hand is on the sensor
Serial.println("button1");
break;
case 1: // your hand is close to the sensor
Serial.println("button2");
break;
case 2: // your hand is a few inches from the sensor
Serial.println("button3");
break;
case 3: // your hand is nowhere near the sensor
Serial.println("button4t");
break;
case 4: // your hand is nowhere near the sensor
Serial.println("button5");
break;
case 5: // your hand is nowhere near the sensor
Serial.println("button6");
break;
case 6: // your hand is nowhere near the sensor
Serial.println("button7");
break;
case 7: // your hand is nowhere near the sensor
Serial.println("button8");
break;
case 8: // your hand is nowhere near the sensor
Serial.println("button9");
break;
case 9: // your hand is nowhere near the sensor
Serial.println("button10");
break;
case 10: // your hand is nowhere near the sensor
Serial.println("button11");
break;
case 11: // your hand is nowhere near the sensor
Serial.println("button12");
break;
case 12: // your hand is nowhere near the sensor
Serial.println("button13");
break;
}
delay(1); // delay in between reads for stability
}