first commit

This commit is contained in:
jaksatomovic 2024-03-06 12:40:28 +01:00
commit 868b14f8c8
286 changed files with 59925 additions and 0 deletions

View file

@ -0,0 +1,45 @@
/////////////////////////////////////////////////////////////////
#include "Button2.h"
/////////////////////////////////////////////////////////////////
#define BUTTON_A_PIN 2
#define BUTTON_B_PIN 0
/////////////////////////////////////////////////////////////////
Button2 buttonA, buttonB;
/////////////////////////////////////////////////////////////////
void setup() {
Serial.begin(9600);
delay(50);
Serial.println("\n\nMultiple Buttons Demo");
buttonA.begin(BUTTON_A_PIN);
buttonA.setClickHandler(click);
buttonB.begin(BUTTON_B_PIN);
buttonB.setClickHandler(click);
}
/////////////////////////////////////////////////////////////////
void loop() {
buttonA.loop();
buttonB.loop();
}
/////////////////////////////////////////////////////////////////
void click(Button2& btn) {
if (btn == buttonA) {
Serial.println("A clicked");
} else if (btn == buttonB) {
Serial.println("B clicked");
}
}
/////////////////////////////////////////////////////////////////