#include <JC_Button.h>
Button button( 9 );
void setup()
{
Serial.begin( 115200 );
button.begin();
}
void loop()
{
static uint32_t timer = 0;
if ( timer == 0 )
{
button.read();
if ( button.wasReleased() )
{
timer = millis();
Serial.println( "timer started" );
}
}
else if ( millis() - timer >= 5000UL )
{
Serial.println( "high" );
static uint8_t counter = 0;
if ( ++counter == 3 )
{
timer = 0;
counter = 0;
Serial.println( "done" );
}
else
{
timer = millis();
}
}
}