Hey, I am using servos to make a robotic arm, and I cant get the servos to stop shaking. Even just the servo itself sometimes shakes. I am unable to fix this, and I am controlling the servos with potentiometers. Here is my code:
#include <Servo.h>
Servo myservo; // create servo object to control a servo
int servoPin = 3; // define the pin of servo signal line
int potPin = 0; // analog pin used to connect the potentiometer
int potVal; // variable to read the potValue from the analog pin
void setup() {
myservo.attach(servoPin); // attaches the servo on servoPin to the servo object
}
void loop() {
potVal = analogRead(potPin); // reads the potValue of the potentiometer
potVal = map(potVal, 0, 1023, 0, 180);// scale it to use it with the servo
myservo.write(potVal); // sets the servo position
delay(15); // waits for the servo to get there
}
In the cod