Servo problems
Hoffa
Posts: 46
Hi
I have a big problem using my servos.
If I use my own code:
The servos works fine and rotates together.
If I use the file servo32 to steer my servos they try to rotate forward, but it goes very slow and there are a big pause between every pulse.
Here is the code that I use to steer the servos using servo32:
I have a big problem using my servos.
If I use my own code:
PUB start repeat setPin(0) left setPin(1) left PUB setPin(pinnr) Pin := pinnr PUB left outa[noparse][[/noparse]Pin]~ ' Clear I/O Pin dira[noparse][[/noparse]Pin]~~ ' Make Pin Output pulsOut(1500) clock.PauseMSec(20) PUB right outa[noparse][[/noparse]Pin]~ ' Clear I/O Pin dira[noparse][[/noparse]Pin]~~ ' Make Pin Output pulsOut(1500) clock.PauseMSec(20) PUB pulsOut(uSec) outa[noparse][[/noparse]Pin]~~ ' Set I/O Pin clock.PauseUSec(uSec) outa[noparse][[/noparse]Pin]~ ' Clear I/O Pin
The servos works fine and rotates together.
If I use the file servo32 to steer my servos they try to rotate forward, but it goes very slow and there are a big pause between every pulse.
Here is the code that I use to steer the servos using servo32:
OBJ servo : "Servo32" clock : "Clock" PUB start turnleft(0,200) turnright(1,200) servo.Start PUB center(servoNr) turn(servoNr, centerpuls) PUB turnleft(servoNr, amount) turn(servoNr, centerpuls+amount) PUB turnright(servoNr, amount) turn(servoNr, centerpuls-amount) PUB turn (servoNr, pulses) servo.Set(defaultServoPin+servoNr, pulses)
Comments
blink or beep sequence at the very start of the code. This way you know immediately if it resets.
(When the batteries get low on my bot it tends to show up as frequent prop resets.)