Professional Documents
Culture Documents
1. Modify Chapter 9 Example 2, show the value of potentiometer and servo motor
position on the LCD.
Souce Code:
#include <Servo.h>
#include <LiquidCrystal.h>
Servo servo_9;
void setup()
pinMode(A1,INPUT);
servo_9.attach(A0);
lcd.begin(16, 2);
lcd.print("Pot Value:");
lcd.setCursor(0,1);
lcd.print("Deg Value:");
void loop()
int pot=analogRead(A1);
lcd.setCursor(11,0);
lcd.print(pot);
lcd.print(" ");
lcd.setCursor(11,1);
lcd.print(deg);
lcd.print(" ");
servo_9.write(deg);