I managed to get it working,
I managed to get it working, thanks for all your posts
This is what I ended up with. The first part was to work out the limits of the crane (grapper, lift and slew).
The second bit is an attempt to attach a switch and the third part is the looped program
i2cslave $C2,i2cslow,i2cbyte ’ Join i2c with SD21 ’ grabber (servo 1) 1. 'i2cwrite 0,(10) ’ speed opening (1 to 16)
'i2cwrite 63,(225) ’ Set servo 1 to 255 (full open 225)
'pause 3000
'i2cwrite 0,(10) ’ speed closing
'i2cwrite 63,(70) ’ closed 70
'pause 3000
’ lift (servo 3)lower number adds height
'i2cwrite 6,(10) ’ speed opening (1 to 16)
'i2cwrite 65,(60) ’ Set servo 1 to 255
'pause 3000
’ slew (servo 2)
'main:i2cwrite 3,(5) ’ speed
'i2cwrite 64,(10) ’ slew anticlockwise
'pause 4000
'i2cwrite 3,(5) ’ slew clockwise
'i2cwrite 64,(145)
'pause 4000
2.
main:
label_2:
if pin0 = 1 then label_7 'Decision command
goto label_2
label_7:
high 1
high 4
low 1
low 4
goto label_2
3.
main:
i2cwrite 6,(10) ’ lift (servo 3)lower number adds height
i2cwrite 65,(60) ’ start position
i2cwrite 3,(5) ’ slew (servo 2)
i2cwrite 64,(145) ’ start position
i2cwrite 0,(10) ’ grabber (servo 1) open position
i2cwrite 63,(225) ’ start position
i2cwrite 3,(5) ’ slew anticlockwise
i2cwrite 64,(10)
pause 4000
i2cwrite 6,(5) ’ lower arm
i2cwrite 65,( 130)
pause 3000
i2cwrite 0,(10) ’ grabber closing
i2cwrite 63,(70)
pause 3000
i2cwrite 6,(5) ’ lift arm
i2cwrite 65,(60)
pause 3000
i2cwrite 3,(5) ’ slew clockwise
i2cwrite 64,(145)
pause 4000
i2cwrite 0,(10) ’ open grabber
i2cwrite 63,(225)
pause 3000
goto main
My next question is how to activate a servo sequence from a high input. There are 2 seperate servo sequences operated by 2 seperate inputs
regards
michael