I'm making a thrust vector control mount, and I wanted to test it to see if it could withstand the stress of a firing motor and still move around. To do this I made a simple circuit with two servos. When I try to run the code using only one of the two servos, it works fine, but if I run the code with two servos they start to jerk around, but don't do what I want them to do. I'm using an Arduino Uno and two 9 gram servos. If anyone knows how to fix this, please tell me. Thanks!
Here is my code:
#include <Servo.h> // add servo library
Servo servoY;
Servo servoX;
int valx = 0;
int valy = 90;
int adder = 5;
int adder2 = -5;
void setup() {
Serial.begin(9600);
servoX.attach(8);
servoY.attach(9);
}
void loop() {
servoX.write(valx);
servoY.write(valx);
delay(500);
Serial.print(valx);
Serial.print("\n");
if (valx == 180) {
valx = 0;
}
else if (valx == 0) {
valx = 180;
}
}```