hi guys im using a picaxe AXE230 microcontroller and ive hooked it up to three servos nad a battery pack, the board works fine, its just the robot won't walk forward it will only march on the spot, here is the code i am using i got this code from http://letsmakerobots.com/node/29379, it for some reason wont walk forward, please tell me if i need to change anything about the code, heere is the code:
symbol lfoot = 1 ' set the pin number for servo
symbol rfoot = 4 ' set the pin number for servo
symbol balance =2 ' set the pin number for servo
symbol round = b6 ' variable used to loop one left + right footstep
Symbol LFoo = b0 LFoo = 120 ' Set and initiate feet twister variable
symbol balanservo = b3 balanservo = 166 ' Set and initiate balance variable (10 more than optimal balance / middle for the balance servo)
servo lfoot, LFoo ' initiate servo
servo rfoot, LFoo ' initiate servo
servo balance, balanservo ' initiate servo
symbol speed = 1' set to higher for slower walking
wait 5 ' wait for the robot to be placed on ground before moving
main:
for round = 1 to 120 ' main variable to dictate all action flow
select case round
case 1 to 60
inc lfoo
if round < 15 then
balanservo = balanservo +1
endif
if round > 40 and round < 50 then
balanservo = balanservo -2
endif
if round> 49 then
balanservo = balanservo -1
endif
case 61 to 120
dec lfoo
if round < 75 then
balanservo = balanservo -1
endif
if round > 100 and 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
can you see any reason why it would not walk forward?
its not fully built it still needs neck and battery head, haha
symbol lfoot = 1 ' set the pin number for servo
symbol rfoot = 4 ' set the pin number for servo
symbol balance =2 ' set the pin number for servo
symbol round = b6 ' variable used to loop one left + right footstep
Symbol LFoo = b0 LFoo = 120 ' Set and initiate feet twister variable
symbol balanservo = b3 balanservo = 166 ' Set and initiate balance variable (10 more than optimal balance / middle for the balance servo)
servo lfoot, LFoo ' initiate servo
servo rfoot, LFoo ' initiate servo
servo balance, balanservo ' initiate servo
symbol speed = 1' set to higher for slower walking
wait 5 ' wait for the robot to be placed on ground before moving
main:
for round = 1 to 120 ' main variable to dictate all action flow
select case round
case 1 to 60
inc lfoo
if round < 15 then
balanservo = balanservo +1
endif
if round > 40 and round < 50 then
balanservo = balanservo -2
endif
if round> 49 then
balanservo = balanservo -1
endif
case 61 to 120
dec lfoo
if round < 75 then
balanservo = balanservo -1
endif
if round > 100 and 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
can you see any reason why it would not walk forward?
its not fully built it still needs neck and battery head, haha