#include <Bounce2.h>
#include <LiquidCrystal.h>
#define tipkaz 4
#define tipkar 5
volatile bool stanje=LOW;
unsigned long zadnji_odboj=0;
int zakasnitev=200;
LiquidCrystal lcd(12,11,10,9,8,7);
int stevec;
Bounce2:: Button tipka1,tipka2=Bounce2::Button();
void setup() {
// put your setup code here, to run once:
tipka1.attach(tipkaz,INPUT_PULLUP);
tipka2.attach(tipkar,INPUT_PULLUP);
tipka1.interval(10);
tipka2.interval(10);
tipka1.setPressedState(LOW);
tipka2.setPressedState(LOW);
Serial.begin(115200);
pinMode(tipkar, INPUT_PULLUP);
attachInterrupt(digitalPinToInterrupt(tipkar),ISR_tipka,FALLING);
}
void loop() {
// put your main code here, to run repeatedly:
tipka1.update();
tipka2.update();
if(tipka1.pressed()){
stevec++;
Serial.println(stevec);
}
if(tipka2.pressed()){
stevec=0;
Serial.println(stevec);
}
}
void ISR_tipka(){
if((millis()-zadnji_odboj)>zakasnitev){
stanje=!stanje;
zadnji_odboj=millis();
}
}