Arduino biped code

I’m building a 4 servo biped robot, but I barely know any arduino. I just need a code for this bit to walk and then I could learn off that code for future robots. Thanks if you can help.https://www.youtube.com/watch?v=VXr6EwmRpGk?version=3

You only need a few commands

First off, you are going to need a variable for the position of each servo. Then you are going to need to be familiar with a “for” loop which will be used to slowly move each servo step by step in a controlled way. That is really it. BTW, there is of course the “sweep” example in the IDE that can show you this.

From here, you need to make 8 individual loops. Left lift, left rotate, left down, left rotate back, right lift, right rotate, right down, right rotate back. Each of these loops can be coded and tested individually and then later you simply put them together.

That’s it. Pretty simple.

You can try to adapt the

You can try to adapt the code for my MiniBiped (borrowed from OddBot most of it) here: https://www.robotshop.com/letsmakerobots/files/MiniBiped.zip

CtC is right. You need to

CtC is right. You need to start with the basics.

1. Determine what are your servos angles for the robot to move, for instance, the servos start at 90 (center) then you need to tilt the left ankle servo about 45 degrees I think, but you need to determine if it’s center + 45 or center - 45. Same thing when rotating the left hip servo. To do this, try the SerialServo code found as example with the SoftwareServo library. Set your ankle as servo A and hip as servo B, then select the active servo from the keyboard (having the Arduino connected to USB), then send new servo value until you find the one that works. Similar for the other servo.

2. After you found your servo angles, you need to send then step by step, or the robot will have erratic moves. To do that, you need to have a FOR loop for each servo move. Again, start by tilting the robot with the left ankle servo, adding 5 degrees at each loop iteration until you are at the proper angle. Then another FOR loop to rotate the left hip and so on.

Tweak your code until the robot walks nicely, then do more advanced stuff like dancing.

Good luck!

The movement of the servos

The movement of the servos probably isn’t that complicated to figure out. What I can’t understand is how you are shifting the weight and center of gravity as your current setup will not work.
The way you have set it up now you won’t be able to lift the foot of the floor.

The Arduino IDE comes with

The Arduino IDE comes with some nice examples for moving servos. It’s under File->Examples->Servo->

Those two examples is all you need to get started(I think:)

I figured that out after I
I figured that out after I built it and I’m going to use a sliding counter weight or make the foot angle up instead of it lifting the body then it will move forward.

I recommend that you try

I recommend that you try this by yourself. I was checking some code for quadrupeds but decided to code it by myself. Why? Because it’s better to understand when you do it from scratch. The code of others is not always easy to read…who knows what those guys/girls was thinking about during the programming. But yea, fair enough to check out other code. I do not have a biped yet so I just can tell you taht here on LMR are many of them even with code examples. Go to the search page and look for “biped”

I will, I’ll make he biped
I will, I’ll make he biped have big feet, sliding counter weight, and make my own code