Servo Pulse Train
As I am transitioning from the BASIC Stamp to the Javelin Stamp, I'm trying to convert my code around the PWM VP. If I have the following:
PWM servoL = new PWM(CPU.pin1, 50, 50);
and it spins the axle clockwise, how do I get the servo on the right (servoR), to spin its axle counter-clockwise?
Thanks!
PWM servoL = new PWM(CPU.pin1, 50, 50);
and it spins the axle clockwise, how do I get the servo on the right (servoR), to spin its axle counter-clockwise?
Thanks!

Comments
I'm not sure how to affect the duty cycle of the PWM so I can have a servo go from forward to reverse. I can do it fine on the BASIC Stamp but I'm having difficulty with the Javelin Stamp. Can someone help me with some insight on this?
Thanks.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Thanks for your response. I know that 1.5ms is center. Where I'm having a challenge is in the Java code. PWM is extended from VirtualPeripheral. The slice I'm alloted is 8.25ms and the documentation is not clear how much of a fraction of that slice should be set high/low in order for me to reverse the servo. This is what is confusing to me. If the documentation was just a tad clearer, I know I could solve this riddle.
If you look in the Projects\Examples\Manual_v1_0 folder you should find this servo demo:
// Program Listing 4.5 - Basic Servo Control import stamp.core.*; public class ServoControl { static PWM servo = new PWM(CPU.pin12,173,2304); public static void main() { System.out.println("Welcome to Servo Control: "); System.out.println(" r - right"); System.out.println(" l - left"); System.out.println(" c - center"); while (true) { switch ( Terminal.getChar() ) { case 'r': servo.update(130,2304); break; case 'l': servo.update(220,2304); break; case 'c': servo.update(173,2304); break; } } } }Note that the Parallax CR servos are really best for Javelin apps as they allow access to the centering pot -- that allows you to calibrate them to the center (stop) value output by the Javelin.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
I see where I went wrong: like an idiot I misread microseconds for milliseconds.
'Nuff said.
Thanks, again.