#include "OneButton.h"
OneButton button(A0, true);
void setup() {
// put your setup code here, to run once:
pinMode (13,OUTPUT);
button.attachDoubleClick(doubleclick); // link the function to be called on a doubleclick event.
button.attachClick(singleclick); // link the function to be called on a singleclick event.
button.attachLongPressStop(longclick);
}
void loop() {
// put your main code here, to run repeatedly:
button.tick();
delay(10);
}
void singleclick(){ // what happens when the button is clicked
digitalWrite(13,LOW);
}
void longclick(){ // what happens when buton is long-pressed
digitalWrite(13,HIGH);
}