Untitled

 avatar
unknown
plain_text
a year ago
569 B
6
Indexable
#include <Servo.h>
#include <Wire.h> 
#include <LiquidCrystal_I2C.h>

Servo myservo;

LiquidCrystal_I2C lcd(0x27,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display

void setup()
{
  lcd.init();                    
  lcd.backlight();
  Serial.begin(9600);
  myservo.attach(9);
  lcd.print("ready to display");
}

void loop()
{
  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("CursorAngle:");
  lcd.setCursor(13,0);
  int val = map(analogRead(A0), 0, 1023, 0, 180);
  lcd.print(val);
  myservo.write(val);
  delay(500);
}
Editor is loading...
Leave a Comment