// Определяем пины кнопок
#define PIN 2 // Яркость
#define PIN 3 // Включение/выключение
#define PIN 4 // Цветовая температура
byte LED1=9;
byte LED2=10; // Определяем пины для силовых ключей
#include <Servo.h>
#include "GyverButton.h" // Подключаем библиотеки
GButton butt1(2, LOW_PULL, NORM_OPEN);
GButton butt2(3, LOW_PULL, NORM_OPEN);
GButton butt3(4, LOW_PULL, NORM_OPEN); //
Servo myservo;
int pos = 0;
void setup() {
pinMode(9, OUTPUT);
}
void loop() {
butt1.tick();
butt2.tick();
butt3.tick();
if (butt2.isDouble()) {
myservo.attach(5);
for (pos = 0; pos <= 135; pos += 1) {
myservo.write(pos);
delay(10); }
//delay (1000);
myservo.detach();
delay (500);
analogWrite(9, 255);
analogWrite(10, 255);
}
if (butt2.isTriple()) {
myservo.attach(5);
analogWrite(9, 0);
analogWrite(10, 0);
for (pos = 135; pos >= 0; pos -= 1) {
myservo.write(pos);
delay(10); }
//delay (1000);
myservo.detach();
}
}