Help with Sweep for Biped Robot

Hi I am new to programming and I am trying to make a biped robot. I'm trying to make it walk in a straight line but I don't know how to make rightHip (servo) go forward and for the leftHip (servo) go backwards. I am really confused because I dont really understand how sweep works.

This is all I have so far

for (pos = 0; pos <= 180; pos += 1) {
rightHip.write(pos);
delay(10);
}

for (pos = 180; pos >= 0; pos -= 1) {
leftHip.write(pos);
delay(10);
}

I dont really understand how sweep works.

There is a for loop that assigns values to a servo, with small delays to slow the movement of the servo.

If you want to have one servo move through the full range, and then the other one move through the full range, you are going about it correctly. If you want both servos to move "at the same time", you are not.

To make both move at the same time, in opposite directions:

for (pos = 0; pos <= 180; pos += 1)
{
   rightHip.write(pos);
   leftHip.write(180-pos);
   delay(10);
}

(although a hip joint moving 180 degrees does not make sense).

Thank you so much! how many degrees should the hip bend at if I want it to walk?

how many degrees should the hip bend at if I want it to walk?

The same number of degrees as your hip bends.

People have been taking some trouble to try to help you with this project in your other Thread. Why have you started a new Thread for the same project ?

Keep to one Thread so everyone can easily see all the information.

I will suggest to the Moderator to merge them.

...R