Hackster is hosting Hackster Holidays, Ep. 7: Livestream & Giveaway Drawing. Watch now!Tune in to Hackster Holidays, Ep. 7 now!
gamer06
Published

Printing a servo position on the lcd

The LCD shows the position of the servo rotations

BeginnerProtip595
Printing a servo position on the lcd

Things used in this project

Hardware components

Breadboard (generic)
Breadboard (generic)
×1
Alphanumeric LCD, 16 x 2
Alphanumeric LCD, 16 x 2
×1
Jumper wires (generic)
Jumper wires (generic)
×1
SG90 Micro-servo motor
SG90 Micro-servo motor
×1
Arduino UNO
Arduino UNO
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

servo postion

Code

servo postion

C/C++
#include <Servo.h>

#include <LiquidCrystal.h>

 Servo signalPin;
 LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup(){
  lcd.begin(16,2);
  signalPin.attach(13);
}

void loop(){
  for(int i = 0; i< 180; i++){
    lcd.println(i);
    signalPin.write(i);
    delay(15);
  }

  for(int i = 180; i >= 0; i--){
    lcd.setCursor(2,3);
    lcd.println(i);
    signalPin.write(i);
    delay(15); 
  }
}

Credits

gamer06
1 project • 0 followers

Comments