Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Wire.h>
- #include <LiquidCrystal_I2C.h>
- LiquidCrystal_I2C lcd(0x27, 16, 2);
- #include <Servo.h>
- Servo myservo;
- int potpin = A0;
- int val;
- int angle;
- void setup() {
- lcd.begin();
- myservo.attach(9);
- lcd.clear();
- lcd.setCursor(0, 0);
- lcd.print("Tester Servo");
- delay(2000);
- }
- void loop() {
- val = analogRead(potpin);
- angle = map(val, 0, 1023, 0, 180);
- myservo.write(angle);
- delay(5);
- lcd.clear();
- lcd.setCursor(0, 0);
- lcd.print("Val Pot:");
- lcd.setCursor(11, 0);
- lcd.print(val);
- lcd.setCursor(0, 1);
- lcd.print("Unghi :");
- lcd.setCursor(11, 1);
- lcd.print(angle);
- delay(5);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement