#include <Servo.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
// definition des pin
#define I2C_ADDR 0x27
const int potPin = A0;
const int servoPin = 9;
Servo servo1;
LiquidCrystal_I2C lcd(I2C_ADDR, 16, 2);
void setup() {
lcd.init();
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("SNO SERVO ");
lcd.setCursor(0, 1);
lcd.print("V1.0");
Serial.begin(9600);
servo1.attach(servoPin);
}
void loop() {
int potValue = analogRead(potPin);
int angle = map(potValue, 0, 1023, 0, 180);
servo1.write(angle);
lcd.setCursor(0, 0);
lcd.print("Pot: ");
lcd.print(potValue);
lcd.print(" "); // Clear any leftover characters
lcd.setCursor(0, 1);
lcd.print("Angle: ");
lcd.print(angle);
lcd.print(" "); // Clear any leftover characters
delay(100);
}