I still need to finess his legs and maybe some of the code because I want him to walk straight and then I will add the sensor to negotiate obstacles...
I now present to BobbyBot (BB1A) dancing a quick jig.
I now present to BobbyBot (BB1A) dancing a quick jig.
And here is the code:
#include <Servo.h>
Servo frontServo;
Servo backServo;
int centerPos = 90;
int frontRightUp = 72;
int frontLeftUp = 108;
int backRightForward = 75;
int backLeftForward = 105;
void moveForward()
{
frontServo.write(frontRightUp);
backServo.write(backLeftForward);
delay (125);
frontServo.write(centerPos);
backServo.write(centerPos);
delay (65);
frontServo.write(frontLeftUp);
backServo.write(backRightForward);
delay (125);
frontServo.write(centerPos);
backServo.write(centerPos);
delay (65);
}
void setup()
{
frontServo.attach(2);
backServo.attach(3);
}
void loop()
{
moveForward();
delay(150);
}
No comments:
Post a Comment