#include <Servo.h>
#include <LiquidCrystal.h>
Servo servo;
LiquidCrystal lcd(12,11,6,5,4,3); // If using I2C, use (0x27, 16, 2); otherwise, specify the pins (RS, E, D4, D5, D6, D7).
void setup() {
lcd.begin(16, 2); // Initialize the LCD
servo.attach(9); // Attach the servo to pin 9
lcd.setCursor(0, 0);
lcd.print("Servo Angle:");
delay(2000);
lcd.clear();
}
void loop() {
// Display servo angle on the LCD
lcd.setCursor(0, 0);
lcd.print("Angle: 180 deg");
servo.write(180); // Move the servo to 180 degrees
delay(1000); // Delay for stability
lcd.setCursor(0, 1);
lcd.print("Angle: 45 deg ");
servo.write(45); // Move the servo to 45 degrees
delay(1000); // Delay for stability
}