What is wrong with this code? - Protoboard and servos
W9GFO
Posts: 4,010
Hi all,
This code seems straight forward to me but it is not working. When the code is run the servos jump for an instant, then nothing. I've spent way too much time trying to figure this out - my brain stopped working a while ago so I need someone to tell me what I'm forgetting or doing wrong.
Thanks!
Post Edited (W9GFO) : 8/6/2007 6:37:56 PM GMT
This code seems straight forward to me but it is not working. When the code is run the servos jump for an instant, then nothing. I've spent way too much time trying to figure this out - my brain stopped working a while ago so I need someone to tell me what I'm forgetting or doing wrong.
Thanks!
CON _clkmode = xtal1 + pll16x _xinfreq = 5_000_000 Servo1 = 5 MotorR = 6 MotorL = 7 LED1 = 12 LED2 = 13 LED3 = 14 LED4 = 15 PUB Main repeat PWM(motorL, 1500) PWM(motorR, 1500) PWM(servo1, 1500) waitcnt((clkfreq/1000) * 20 + cnt) PUB PWM(pin, width) dira[noparse][[/noparse]pin]~~ !outa[noparse][[/noparse]pin] waitcnt(width * (clkfreq/1_000_000)+ cnt) !outa[noparse][[/noparse]pin]
Post Edited (W9GFO) : 8/6/2007 6:37:56 PM GMT
spin
709B
Comments
Thanks!