#include <Servo.h>
#include <DS18B20.h>
#include <LCD_I2C.h>

Servo testServo;  // create servo object to control a servo
LCD_I2C lcd(0x27, 16, 2);

int servoPin = 11;
int potpin = 0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  
  testServo.attach(servoPin);  // attaches the servo on pin 9 to the servo object
  pinMode(LED_BUILTIN, OUTPUT);

  lcd.begin();
  lcd.backlight();
  
  lcd.print("     Hello"); // You can make spaces using well... spaces
  lcd.setCursor(5, 1); // Or setting the cursor in the desired position.
  lcd.print("World!");

  Serial.println("Ready!");
}

void loop() {
  val = analogRead(potpin);         // reads the value of the potentiometer (value between 0 and 1023)
  val = map(val, 0, 1023, 0, 180);  // scale it to use it with the servo (value between 0 and 180)
	testServo.write(val);             // sets the servo position according to the scaled value

  delay(15);
}