Shop OBEX P1 Docs P2 Docs Learn Events
Servo(Unaction) — Parallax Forums

Servo(Unaction)

HeroHero Posts: 24
edited 2008-12-21 02:06 in General Discussion
Hi

I just ran the servo controller code. I can hear a sound in the servo but it does`nt actually spin. I have tried 2 separate servos.

Could it be the code. I tried to change the servo speeds.

Cheers.

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(400,5000);
break;

case 'l':
servo.update(400,5000);
break;

case 'c':
servo.update(400,5000);
break;
}
}
}
} lol.gif

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-12-19 22:28
    You should only use
    servo.update(x,2304);
    with x ranging from 115 (equals left) to 230 (equals right)
    and 173 being centre.

    The 2304 sets the 20 msec period required for the servos
    2304 * 8.68 usec = 20 msec
    115 * 8.68usec = 1.0 msec
    173 * 8.68usec = 1.5 msec
    230 * 8.68usec = 2.0 msec

    regards peter
    ·
  • HeroHero Posts: 24
    edited 2008-12-20 02:33
    Cheers. When implementing the instructions the blurred sound inside the servo changed.
    When pressing the Left or Center the sound seems to change , but the actual external servo is not in motion.

    what could it be?

    Cheers.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-12-20 14:30
    How are the servos connected?
    Servos need 6V power supply. Do not connect them
    to the Javelin VDD, but make sure the Javelin GND and servo GND
    are connected.

    regards peter
  • HeroHero Posts: 24
    edited 2008-12-20 22:54
    It`s connected to the pin 12 on the Vm Block.
  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2008-12-20 23:54
    You also need to connect Vm to Vdd, as stated on page 57
    in the javelin manual (attached). That page describes
    the servo and the program.

    regards peter
  • HeroHero Posts: 24
    edited 2008-12-21 02:06
    Cheers, sorry for the constant bother.

    One last thing, how do I make the servo movement more robust with out Just recieving pulse movements. So for example if I pressed L I would get a full left rotation
    instead of a small pulse movement left.

    Cheers.
Sign In or Register to comment.