#include <Bounce2.h> // Ukljucenje biblioteke
Bounce T4 = Bounce(); // Kreiranje objekta klace 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);
T4.attach(4,INPUT_PULLUP); // Povezivanje Bounce objekta sa pinom
T4.interval(25); // definisanje Debounce intervala
pinMode(5, OUTPUT);
digitalWrite(5, HIGH);
}
void loop() {
T4.update(); // Citanje stanja tastera
if( T4.fell() ) { // Taster od HIGH ide na LOW. Trenutak pritiska
digitalWrite(5, !digitalRead(5));
}
// put your main code here, to run repeatedly:
delay(50); // this speeds up the simulation
}