source code to coordinate leg of hexapod

I am trying to make an autonomous hexapod 18 DOF using arduino megaboard. I am not using any simulator. I am struck with how to coordinate legs of hexapod. I calculated the angles which are required for a TIBIA to move up and down (ie. suppose for 130 degrees it reaches ground and 15 degrees it reaches horizontal) but i could not able to coordinate TIBIA, FEMUR and COAXIA motors simultaneously to make leg to coordinate for moving.I am using TRIPOID method for the movements.

this is the code which i used-->

#include <Servo.h>
Servo myservo[6][3]; // create servo object to control a servo
//[0] -tibia , [1] -femur , [2] -coxa motors
void setup() {
myservo[0][0].attach(2);
myservo[1][0].attach(3);
myservo[2][0].attach(4);
myservo[3][0].attach(5);
myservo[4][0].attach(6);
myservo[5][0].attach(7);
Serial.begin(9600);
}

void loop() {

//alternatively making hexapod stand at its place
myservo[0].write(130);// to make legs 0,2,4 DOWN
myservo[2].write(130);
myservo[4].write(90);
delay(1000);
myservo[1].write(15);// TO MAKE 1,3,5 UP
myservo[3].write(180);
myservo[5].write(180);
delay(1000);
myservo[0].write(15);//TO MAKE 0,2,4 UP
myservo[2].write(15);
myservo[4].write(180);
delay(1000);
myservo[1].write(130);// TO MAKE 1,3,5 down
myservo[3].write(90);
myservo[5].write(90);
delay(1000);

}

Anyone please checkout this and help me in anyway possible.Suggest me with a source code of hexapod.

If you are working on a hexapod, you need to read up on inverse kinematics.
Google it. Start reading.
Come back and ask questions after you read up on it.