Robot Servo Control

I am creating a project in which I want a robotic arm to complete an incision I am able to get the robot to a particular position by moving each servo to a certain angle individually, however when I want to move one of the same motors that is already at an angle to a different angle my servo jitters because it is reading both commands at once. How can I get the same servo to go to one position and to another position after it already reached that position?

Thanks!

disen:
however when I want to move one of the same motors that is already at an angle to a different angle my servo jitters because it is reading both commands at once. How can I get the same servo to go to one position and to another position after it already reached that position?

That doesn't make much sense. Every single time you write to a servo you're moving it from one position to another. So what is different about the case you're describing?

It might help if you post your code.

Steve

Here is the code I am using you see why my robot may be jittering?

//#include <Arduino.h>

/*
     Servo Motor Control using the Arduino Servo Library
           by Dejan, https://howtomechatronics.com
*/
#include <Servo.h>
Servo a1;  // create servo object to control a servo
Servo a2;
Servo a3;
Servo a4;
Servo a5;
Servo a6;

int posA4 = 0;


void setup(){

  a1.attach(11,600,2300); // Height // (pin, min, max) This servo is backwards input (180 to go to 0) Input (0 to go 180)
  a2.attach(10,800,2300); // Wrist
  a3.attach(9,600,2500); // Small Wrist
  a4.attach(8,600,1500); // shoulder
  a5.attach(7,600,1200); // base
  a6.attach(6,600,2300);// rotation

}

void loop() {
  

  a1.write(50); 
  a2.write(90);
  a3.write(0);
  a4.write(70);
  a5.write(100);
  a6.write(90);// tell servo to go to a particular angle
  delay(10);
  a4.write(90);
  

}

"when I want to move one of the same motors that is already at an angle to a different angle my servo jitters because it is reading both commands at once"

You will need to include an appropriate delay in the code to allow for the servo movements. You might use millis() to move the desired servo in a sub function or similar.

Your loop() is running far too fast for servo a4. It's probably not so much jittering as trying to do what you're asking...move to 70 then 10ms later to 90 then immediately back to 70 etc.

I guess that won't be what you really want the arm to do eventually but for now try changing the delay to something like 500 and add another delay(500) after the a4.write(90). Half a second between moves is a lot more realistic.

Steve