Blazemaguire
Senior Member
Hi,
I've hacked an old school robot we had lying around (from 'scantek2000' if anyone else has seen one before) to run of a PICAXE 18x.
It has 4 futabu servo's controlling Jaw, base, elbow and arm movement.
I've written the simple code below (please see my previous posts.... i'm a newbie to writing BASIC code!) just to test the range of movements and to build from.
It works fine in that it directs the robot to all the extremeties of movement, only it only runs through the routine once - It then just stops, even though there is a 'goto main' command.
I'm fully aware it could be something wrong with my code, but does anyone have any suggestions as to what I could do to get it to repeat on a loop?
Rob
symbol time=500
main:
goto init
goto jaw_open
goto Jaw_closed
goto elbow_Fully_up
goto elbow_fully_down
goto Shoulder_Fully_up
goto Shoulder_Fully_down
goto Base_Turn_Right
goto Base_Turn_Left
goto main
init:
servo 0,150
servo 1,150
servo 2,150
servo 3,150
Jaw_closed:
servopos 0,75
pause time
Jaw_open:
servopos 0,225
pause time
Elbow_Fully_Up:
servopos 1,75
pause time
Elbow_Fully_Down:
servopos 1,225
pause time
Base_Turn_Right:
servopos 2,75
pause time
Base_Turn_Left:
servopos 2,225
pause time
Shoulder_Fully_Up:
servopos 3,75
pause time
Shoulder_Fully_Down:
servopos 3,225
pause time
I've hacked an old school robot we had lying around (from 'scantek2000' if anyone else has seen one before) to run of a PICAXE 18x.
It has 4 futabu servo's controlling Jaw, base, elbow and arm movement.
I've written the simple code below (please see my previous posts.... i'm a newbie to writing BASIC code!) just to test the range of movements and to build from.
It works fine in that it directs the robot to all the extremeties of movement, only it only runs through the routine once - It then just stops, even though there is a 'goto main' command.
I'm fully aware it could be something wrong with my code, but does anyone have any suggestions as to what I could do to get it to repeat on a loop?
Rob
symbol time=500
main:
goto init
goto jaw_open
goto Jaw_closed
goto elbow_Fully_up
goto elbow_fully_down
goto Shoulder_Fully_up
goto Shoulder_Fully_down
goto Base_Turn_Right
goto Base_Turn_Left
goto main
init:
servo 0,150
servo 1,150
servo 2,150
servo 3,150
Jaw_closed:
servopos 0,75
pause time
Jaw_open:
servopos 0,225
pause time
Elbow_Fully_Up:
servopos 1,75
pause time
Elbow_Fully_Down:
servopos 1,225
pause time
Base_Turn_Right:
servopos 2,75
pause time
Base_Turn_Left:
servopos 2,225
pause time
Shoulder_Fully_Up:
servopos 3,75
pause time
Shoulder_Fully_Down:
servopos 3,225
pause time