void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(A0, INPUT_PULLUP);
}
int count = 0;
bool pkey = false;
void loop() {
// put your main code here, to run repeatedly:
bool key = digitalRead(A0);
delay(10);
if (key && !pkey){
pkey = true;
count++;
}
if(!key && pkey){
pkey = false;
}
Serial.println(count);
}