#include <Servo.h>
#define pot A0
Servo myservo1;
Servo myservo2;
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27, 16, 2);
void setup()
{
myservo1.attach(9);
myservo2.attach(10);
lcd.init();
lcd.backlight();
lcd.print("Rachaporn");
lcd.setCursor(0, 1);
lcd.print("S1: S2:");
lcd.setCursor(11, 1);
}
void loop()
{
int i;
for(i=0;i<180;i++)
{
myservo1.write(i);
myservo2.write(180-i);
lcd.setCursor(3,1);
lcd.print( i );
lcd.println((char)223);
lcd.setCursor(12,1);
lcd.print( 180-i );
lcd.println((char)223 ) ;
lcd.println("");
int adc = analogRead(A0);
adc = map (adc,0,1023,0,100);
delay(adc);
}
for(i=180;i>0;i--)
{
myservo1.write(i);
myservo2.write(180-i);
lcd.setCursor(3,1);
lcd.print( i );
lcd.println((char)223);
lcd.setCursor(12,1);
lcd.print( 180-i );
lcd.println((char)223 ) ;
lcd.println("");
int adc = analogRead(A0);
adc = map (adc,0,1023,0,100);
delay(adc);
}
}