Hi,
I’m having a problem with my servo. When I use this code below to control my servo angle, it works with the low load 9g servos (blue ones).
#include <Servo.h>
Servo joint_1;
#define joyX A0
#define joyY A1
#define joint_1_pin 5
int xValue, yValue, pos;
int joint_1_angle;
void setup() {
Serial.begin(9600);
joint_1.attach(joint_1_pin);
joint_1_angle = 90;
joint_1.write(90);
}
void loop() {
xValue = analogRead(joyX);
yValue = analogRead(joyY);
if (xValue < 500) {
joint_1_angle = joint_1_angle - 1;
}
else if (xValue > 600) {
joint_1_angle = joint_1_angle + 1;
}
joint_1.write(joint_1_angle);
Serial.print("xValue: "); Serial.print(xValue);
Serial.print(" yValue: "); Serial.print(yValue);
Serial.print(" Servo Angle: "); Serial.println(joint_1_angle);
delay(1000/20);
}
When I connect it to the larger servo, there is a lot of noise and jitter. The servo still moves in the direction in which we control the angle with the joystick, however, it is very unstable. I am using a 5V 2A unregulated wall adapter. I’m guessing this issue is because the power requirements for this are much larger than the small servo.
Any insights to why this may be happening, and if there are any solutions?