'''Walking Servos
'''------------------------------------------------------
'''Servos attached to PortB.0 and PortB.1
'''@licence GPL
'''@version 0.0
'''***************************************************************************
;Chip Settings
#chip 16F887,16
#option explicit
;Variables
Dim PulseTime As byte
Do Forever
'Servo 0
PortC.5 = 1
'Rotate servo 0, change pulse 650 to 2250 us
For PulseTime = 65 to 225
'Send the right length pulse
PulseOut PORTB.0, PulseTime 10us
Wait 6 ms
Next
'Rotate back, change pulse 2250 to 650 us)
For PulseTime = 225 to 65
'Send the right length pulse
PulseOut PORTB.0, PulseTime 10us
Wait 6 ms
PortC.5 = 0
Next
'Servo 1
'Rotate servo 1, change pulse 650 to 2250 us
PortC.0 = 1
For PulseTime = 65 to 225
'Send the right length pulse
PulseOut PORTB.1, PulseTime 10us
Wait 6 ms
Next
'Rotate back, change pulse 2250 to 650 us)
For PulseTime = 225 to 65
'Send the right length pulse
PulseOut PORTB.1, PulseTime 10us
PortC.0 = 0
'After sending pulse, wait a bit before sending the next one
Wait 6 ms
Next
Loop
end
Make a free website with Yola