#include <LiquidCrystal_I2C.h>
#include <Servo.h>
LiquidCrystal_I2C lcd(0x27,16,2);
Servo myservo;
int led=13;
void setup() {
// put your setup code here, to run once:
lcd.init();
lcd.backlight();
pinMode(11,OUTPUT);
myservo.attach(11);
}
void loop() {
// put your main code here, to run repeatedly:
int val = analogRead(A0);
float vol = val /1023.0*5.0;
lcd.home();
lcd.print("ADC value:");
lcd.print(val);
lcd.print(' ');
lcd.setCursor(0,1);
lcd.print("voltage val:");
lcd.print(vol);
int temp =map(val,0,1023,0,255);
int temp2 = map(val,0,1023,0,180);
analogWrite(11,temp);
myservo.write(temp2);
}