mirror of
https://github.com/AlexGyver/GyverLamp.git
synced 2025-08-09 09:19:12 +03:00
add
This commit is contained in:
20
libraries/GyverButton/examples/_1-2-3-click/_1-2-3-click.ino
Normal file
20
libraries/GyverButton/examples/_1-2-3-click/_1-2-3-click.ino
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Пример использования библиотеки GyverButton, 1- 2- 3- нажатие
|
||||
*/
|
||||
|
||||
#define PIN 3 // кнопка подключена сюда (PIN --- КНОПКА --- GND)
|
||||
|
||||
#include "GyverButton.h"
|
||||
GButton butt1(PIN);
|
||||
|
||||
void setup() {
|
||||
Serial.begin(9600);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
butt1.tick(); // обязательная функция отработки. Должна постоянно опрашиваться
|
||||
|
||||
if (butt1.isSingle()) Serial.println("Single"); // проверка на один клик
|
||||
if (butt1.isDouble()) Serial.println("Double"); // проверка на двойной клик
|
||||
if (butt1.isTriple()) Serial.println("Triple"); // проверка на тройной клик
|
||||
}
|
Reference in New Issue
Block a user