#include <Servo.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 16, 2);
Servo myservo;
int servoPin = 9;
int servoAngle = 0;
#define LED_PIN 5
#define POT1_PIN A0
#define POT2_PIN A1
void setup() {
pinMode(LED_PIN, OUTPUT);
myservo.attach(servoPin);
myservo.write(servoAngle);
lcd.init();
lcd.backlight();
lcd.clear();
}
void loop() {
int pot1Value = analogRead(POT1_PIN);
int pot2Value = analogRead(POT2_PIN);
lcd.setCursor(0, 0);
lcd.print("pot1Value = ");
lcd.print(pot1Value);
lcd.setCursor(0, 1);
lcd.print("pot2Value = ");
lcd.print(pot2Value);
int delayTime = map(pot1Value, 0, 1023, 100, 2000);
servoAngle = map(pot2Value, 0, 1023, 0, 180);
myservo.write(servoAngle);
digitalWrite(LED_PIN, HIGH);
delay(delayTime);
// Вимикаємо світлодіод
digitalWrite(LED_PIN, LOW);
delay(delayTime);
}