#include <Ticker.h>
#include <ButtonDebounce.h>
ButtonDebounce button(2, 250);
int counter = 0;
void buttonChanged(const int state)
{
if (!state)
{
}
}
void zaehlen ()
{
bool state = button.state();
if (!state)
{
counter++;
Serial.println(counter);
}
}
Ticker ticker(zaehlen,500);
void setup()
{
ticker.start();
Serial.begin(9600);
button.setCallback(buttonChanged);
}
void loop()
{
button.update();
ticker.update();
}