HelloI need help I wrote asimple code

Hello everybody

I wrote a code as simple as it can be. As you can see. I need a smooth coordinated movement loaded into arduino to control two Hitec HS-5485 HB digital Servo. I do get the movement order. But how can I make it slowwwwer. It moves in a fix movement rate. What do I miss in the code. And why can I find any code written to program servos without help of PC or pots or joysticks.

Does the digital servos make a problem. But I have no problem running them. I can use sweep code to move them smootly but it is a nightmare to wire continous codes from sweep.

Is there a simple program to do this type of write programing.

Regards

regards

// coordinated slow movement


#include <Servo.h>

Servo servo1;  // create servo object to control a servo
Servo servo2;  // create servo object to control a servo
               // a maximum of eight servo objects can be created


int pos = 0;    // variable to store the servo position

void setup()
{

 servo1.attach(9) ;  // attaches the servo on pin 9 to the servo object
 servo2.attach(10) ;  // attaches the servo on pin 9 to the servo object


}



void loop()
{

{

 servo1.write(45);      // 1  

 delay(1000);

 }

{

 servo2.write(135);     //2

 delay(1000);
 }
{

 servo1.write(135);    //3

 delay(1000);
 }

{

 servo2.write(45);    //4

 delay(1000);
 }

{

 servo1.write(75);    //5

 delay(1000);
 }

{

 servo2.write(105);    //6

 delay(1000);
 }

{

 servo1.write(105);    //7

 delay(1000);
 }
{

 servo2.write(75);    //8

 delay(1000);
 }

}

store all the sweep positions in an array and have a index counter

myArray = {0,1,2,3,4,5}

void loop()
{
sweep();
{

function sweep(){
newPos = myArray[idx];
servo1.write(newPos)'
delay(1000);

idx++;
idx%=myArray.length
}

need to rewrite that in c