A servomotor is a linear actuator or rotary actuator that allows for precise control of linear or angular position, acceleration, and velocity. It consists of a motor coupled to a sensor for position feedback. It also requires a relatively sophisticated controller, often a dedicated module designed specifically for use with servomotors.
CIRCUIT DIAGRAM
CODE
#include<Servo.h>
Servo myservo;
int pot=0;
int angle=0;
void setup()
{
myservo.attach(5);
Serial.begin(9600);
}
void loop()
{
pot = analogRead(A5);
angle = map(pot,0,1023,0,180);
myservo.write(angle);
}
Comments