Hi
I am working on a robotics project which employs 4 servos operating sequentially. In order to check the operation of the servos and to set the travel limits I wrote a simple little program to perform these operations. Except things are not as simple as they seem. Originally the program was set up to test all 4 servos. But when that didn't work out I whittled it down to test only the widget servo and the black servo. Here is what is happening:
I am at my wits end and frustrated especially after investing many hours building the model. Am I not seeing the forest for the trees or is servo control more complicated than indicated in the manual? Any suggestions will be greatly appreciated.
I am working on a robotics project which employs 4 servos operating sequentially. In order to check the operation of the servos and to set the travel limits I wrote a simple little program to perform these operations. Except things are not as simple as they seem. Originally the program was set up to test all 4 servos. But when that didn't work out I whittled it down to test only the widget servo and the black servo. Here is what is happening:
- The only servo that seems to initialize is the widget servo.
- The black servo remains completely inert; no output on pin B.3.
- The same result is obtained using digital or analog servos.
- The activeServo variable was added after the fact when the original configuration didn't work. Same result.
- In fact, the ONLY pin that shows an output is B.5 (widget) and it operates exactly like it is supposed to
I am at my wits end and frustrated especially after investing many hours building the model. Am I not seeing the forest for the trees or is servo control more complicated than indicated in the manual? Any suggestions will be greatly appreciated.
Code:
'******************Servo Test Code.bas****************
'Version 1.0
'AJZ/December 27, 2015
'this code is used in conjunction with the widget sorter
'code to test and set limts for the servos
'===Outputs===
symbol stack_servo = B.6 'pushes widgets from stack onto platform
symbol widget_servo = B.5 'pushes widgets from platform onto conveyor belt
symbol black_servo = B.3 'pushes widgets from conveyor belt into black widget box
symbol white_servo = B.1 'pushes widgets from conveyor belt into white widget box
'===Variables===
symbol pos0 = b0
symbol pos1 = b1
symbol activeServo = b11
'===Directives===
#com 1 'specify serial port
#picaxe 18M2 'specify processor
init:
gosub initialize 'make sure servos are initialize
pause 2000
main:
gosub widget
pause 1000
gosub black
pause 1000
'gosub white
'pause 1000
'gosub stack
'pause 1000
goto main
initialize:
activeServo = black_servo
servo activeServo,100 'initialise black push servo
activeServo = widget_servo
servo activeServo,80 'initialise widget serv
'servo white_servo,100 'initialise white push servo
'servo stack_servo,100 'initialise stack servo
return
widget:
activeServo = widget_servo
for pos0 = 80 to 180 ; move servo to one end
servopos activeServo, pos0
pause 2
next pos0
for pos0 = 180 to 80 step -1 ; move servo to other end
servopos activeServo,pos0
pause 2
next pos0
return
black:
activeServo = black_servo
for pos1 = 100 to 200 ; move servo to one end
servopos activeServo, pos1
pause 2
next pos1
for pos1 = 200 to 100 step -1 ; move servo to other end
servopos activeServo ,pos1
pause 2
next pos1
return