Servo continuous rotation
I can get a servo to rotate continuously. I add a second servo, they both pulse instead of continuously rotating.
Do I have to code-up some special CPU delay. They continously rotate on their own but when they're put together, it seems like they're attempting to share the same HIGH on separate pins.
Any ideas?
Post Edited (bxgirten) : 7/21/2005 9:53:29 PM GMT
Do I have to code-up some special CPU delay. They continously rotate on their own but when they're put together, it seems like they're attempting to share the same HIGH on separate pins.
Any ideas?
Post Edited (bxgirten) : 7/21/2005 9:53:29 PM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
/**
* Drives both servo at high speed
*
* @version 1.0 5/7/02
* @author Parallax, Inc.
*/
public class JBotServo4 {
static PWM pwmR = new PWM(CPU.pin12); // create right servo
static PWM pwmL = new PWM(CPU.pin13); // create left servo
public static void main() {
pwmR.update( 110, 255 ) ;
pwmL.update( 240, 255 ) ;
pwmR.start () ;
pwmL.start () ;
CPU.delay(10000); // run for one second
pwmR.stop () ;
pwmL.stop () ;
}
}
· This sounds like a classic example of inadequate power.· First thing to do is try this code, the servos should run for one second then stop.· If you keep getting a '1' in the debug window then the Javelin is resetting most likely do to brownout.
· Also it looks like the code you are using is from the JavelinBOT book.· Some of the classes have changed since the book was written, notice the change in the PWM class declaration.· Also you do not need to start the PWM, with the new classes it is started when it is declared and issuing a start actually has an adverse effect.· Here is the code.
·A couple of things to try if you Javelin is resetting.· Depending on the kits you may have received, you should have a 3300uF capacitor, connect this across Vin and Vss, with the negative lead going to Vss.· The AppMod header is the best place to connect this.
· If you don't have that, then do what in my opinion is the best option,·use a separate power supply for the servos.· The negative would go to·Vss and the positive would go to Vm if you have the Javelin Stamp Demo Board.· I use a R/C system receiver pack as that is what it is designed for.· I actually use both the separate power supply and the capacitor on my JBOT.
· In addition when you get to one of the later chapters it discusses ramping code this will also additionally help in this situation.
Kevin
Post Edited (Kevin B Slater) : 7/22/2005 2:23:00 PM GMT