habs endlich hinbekommen
funzt ganz gut auch ohne debounce, geht aber bestimmt auch eleganter
const int buttonPin = 12;
int buttonState = 0;
int counter = 0;
int buttonStateHIGH = 0;
void setup() {
Serial.begin(9600);
pinMode(buttonPin, INPUT);
}
void loop(){
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH)
{
buttonStateHIGH = 1;
}
if (buttonState == LOW && buttonStateHIGH == 1)
{
counter++;
buttonStateHIGH = 0;
}
Serial.println(counter);
}
besten dank für die hilfe
greetz
akrlfix