/*Javelin Stamp SERVO TEST Created by Ron Kessler Oct 2, 2012 This lets you test your servo to see how to control it. BOTH SERVOS SHOULD GO FORWARDS. */ /* Pulse Width Modulation (PWM) settings: 1.5ms centers/stops servo 1.7ms CCW full speed 1.3ms CW full speed Pulses must be sent every 20ms Javelin stamp uses a 8.68us (microsecond) time base. For the PWM arguments below: cw(clockwise) = 1300us / 8.68us = 150 ccw = 1700 / 8.68 = 196 center/stop = 1500 / 8.68 = 173 Pulse frequency = 20ms so 20000 / 8.68 = 2304 */ //******************PROGRAM START****************** import stamp.core.*; //package/namespace to use public class ServoTest { static PWM rightServo = new PWM(CPU.pin12,173,2304); static PWM leftServo = new PWM(CPU.pin13,173,2304); static int cw = 115; static int ccw =220; static int ptime = 2304; public static void main() { while (true) { rightServo.update(cw,ptime); leftServo.update(ccw,ptime); } } }