#include <Bounce2.h> // Ukljucenje biblioteke
Bounce TGreen = Bounce(); // Kreiranje objekta klace Bounce
Bounce TBlue = Bounce();
/**
bool update () Updates the pin's state.
bool read () const Returns the pin's state (HIGH or LOW).
bool fell () const Returns true if pin signal transitions from high to low.
bool rose () const Returns true if pin signal transitions from low to high.
bool changed () const Returns true if the state changed on last update
*/
void setup() {
// put your setup code here, to run once:
Serial1.begin(115200);
Serial1.println("Hello, Raspberry Pi Pico!");
//pinMode(4, INPUT_PULLUP);
TGreen.attach(4,INPUT_PULLUP); // Povezivanje Bounce objekta sa pinom
TGreen.interval(25); // definisanje Debounce intervala
TBlue.attach(6, INPUT_PULLUP);
TBlue.interval(50);
pinMode(5, OUTPUT);
digitalWrite(5, HIGH);
}
void loop() {
TGreen.update(); // Citanje stanja tastera
if( TGreen.fell() ) { // Taster od HIGH ide na LOW. Trenutak pritiska
digitalWrite(5, !digitalRead(5));
}
TBlue.update();
if( TBlue.rose() ) { // Kada se otpusti taster
digitalWrite(5, !digitalRead(5));
}
// put your main code here, to run repeatedly:
delay(50); // this speeds up the simulation
}