3 servo biped walking robot - converting from picaxe to arduino
hello everyone,
http://letsmakerobots.com/node/29379
i started building robot , built , tested movement sweep servo example, moved great.
but need make walk arduino, original creator used picaxe , provided code :
ive tried studying couldnt make sense of it, tried using sweep servo example , modifying move 3 servos in fluid sequence:
this did not work @ because seems servos return original position after movement, furthermore not move in fluid movement, each seperate servo moving alone.
how make work simularly picaxe code?
i not experienced arduino code made may not make sense @ all.
i appreciate thankyou in advance
http://letsmakerobots.com/node/29379
i started building robot , built , tested movement sweep servo example, moved great.
but need make walk arduino, original creator used picaxe , provided code :
code: [select]
symbol lfoot = 1 ' set pin number servo
symbol rfoot = 4 ' set pin number servo
symbol balance =2 ' set pin number servo
symbol round = b6 ' variable used loop 1 left + right footstep
symbol lfoo = b0 lfoo = 120 ' set , initiate feet twister variable
symbol balanservo = b3 balanservo = 166 ' set , initiate balance variable (10 more optimal balance / middle balance servo)
servo lfoot, lfoo ' initiate servo
servo rfoot, lfoo ' initiate servo
servo balance, balanservo ' initiate servo
symbol speed = 1' set higher slower walking
wait 5 ' wait robot placed on ground before moving
main:
for round = 1 120 ' main variable dictate action flow
select case round
case 1 60
inc lfoo
if round < 15 then
balanservo = balanservo +1
endif
if round > 40 , round < 50 then
balanservo = balanservo -2
endif
if round> 49 then
balanservo = balanservo -1
endif
case 61 120
dec lfoo
if round < 75 then
balanservo = balanservo -1
endif
if round > 100 , round < 110 then
balanservo = balanservo +2
endif
if round > 109 then
balanservo = balanservo +1
endif
end select
' set servos:
servopos balance, balanservo
servopos lfoot, lfoo
servopos rfoot, lfoo
pause speed
next round
goto main
ive tried studying couldnt make sense of it, tried using sweep servo example , modifying move 3 servos in fluid sequence:
code: [select]
/* sweep
barragan <http://barraganstudio.com>
example code in public domain.
modified 8 nov 2013
scott fitzgerald
http://www.arduino.cc/en/tutorial/sweep
*/
#include <servo.h>
servo liftservo; // create servo object control servo
servo leftfoot;
servo rightfoot;
int liftpos = 0;// variable store servo position
int leftpos = 0;
int rightpos = 0;
int delay1 = 15;
void setup() {
liftservo.attach(9); // attaches servo on pin 9 servo object
leftfoot.attach(10);
rightfoot.attach(11);
}
void loop() {
//-------------------------------------------------------------------------------------------------------------
delay(delay1);
(liftpos = 60; liftpos <= 120; liftpos += 1) { //lift the left side
liftservo.write(liftpos);
delay(10);
}
//------------------------------------------------------------------------------------------------------------
delay(delay1);
(leftpos = 70; leftpos <= 110; leftpos += 1) {
leftfoot.write(leftpos);
delay(10);
}
//-------------------------------------------------------------------------------------------------------------
delay(delay1);
(rightpos = 70; rightpos <= 110; rightpos += 1) {
rightfoot.write(rightpos);
delay(10);
}
//-------------------------------------------------------------------------------------------------------------
delay(delay1);
(liftpos = 120; liftpos <= 60; liftpos += 1) {
liftservo.write(liftpos); //lift right side
delay(10);
}
//-------------------------------------------------------------------------------------------------------------
delay(delay1);
(liftpos = 60; liftpos >= 120; liftpos -= 1) { //lift the left side
liftservo.write(liftpos);
delay(10);
}
//-------------------------------------------------------------------------------------------------------------
delay(delay1);
(leftpos = 110; leftpos <= 70; leftpos += 1) {
leftfoot.write(leftpos);
delay(10);
}
//-------------------------------------------------------------------------------------------------------------
delay(delay1);
(rightpos = 110; rightpos <= 70; rightpos += 1) {
rightfoot.write(rightpos);
delay(10);
}
//-------------------------------------------------------------------------------------------------------------
delay(delay1);
(liftpos = 120; liftpos >= 60; liftpos -= 1) {
liftservo.write(liftpos); //lift right side
delay(10);
}
}
this did not work @ because seems servos return original position after movement, furthermore not move in fluid movement, each seperate servo moving alone.
how make work simularly picaxe code?
i not experienced arduino code made may not make sense @ all.
i appreciate thankyou in advance
Arduino Forum > Using Arduino > Programming Questions > 3 servo biped walking robot - converting from picaxe to arduino
arduino
Comments
Post a Comment