#include "Button.h"
const int pin12 = 12;
const int pin11 = 11;
Button boutonPin1(13);
unsigned long currentMillis =0;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
boutonPin1.begin();
boutonPin1.set_repeat(500, 200);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
}
bool pressed=false;
void loop() {
currentMillis = millis();
// put your main code here, to run repeatedly:
if (boutonPin1.pressed()) {
pressed=true;
Serial.print("pressed");
digitalWrite(pin12, HIGH);
digitalWrite(pin11, LOW);
}else{
digitalWrite(pin12, LOW);
pressed=false;
}
if(currentMillis%10 > 0 ){
digitalWrite(pin11, HIGH);
}
}
/*
Button - a small library for Arduino to handle button debouncing
MIT licensed.
*/