12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
-
- #include <Bounce2.h>
- #define BUTTON_PIN_1 2
- #define BUTTON_PIN_2 3
- #define LED_PIN 13
- Bounce debouncer1 = Bounce();
- Bounce debouncer2 = Bounce();
- void setup() {
-
- pinMode(BUTTON_PIN_1,INPUT_PULLUP);
-
- debouncer1.attach(BUTTON_PIN_1);
- debouncer1.interval(5);
-
-
- pinMode(BUTTON_PIN_2,INPUT_PULLUP);
-
- debouncer2.attach(BUTTON_PIN_2);
- debouncer2.interval(5);
-
- pinMode(LED_PIN,OUTPUT);
- }
- void loop() {
-
- debouncer1.update();
- debouncer2.update();
-
- int value1 = debouncer1.read();
- int value2 = debouncer2.read();
-
- if ( value1 == LOW || value2 == LOW ) {
- digitalWrite(LED_PIN, HIGH );
- }
- else {
- digitalWrite(LED_PIN, LOW );
- }
- }
|