Shop OBEX P1 Docs P2 Docs Learn Events
Servo control question — Parallax Forums

Servo control question

GreenTHHNGreenTHHN Posts: 11
edited 2010-06-17 02:46 in Propeller 1
I am trying to control a couple servo motors using the Parallax 2-axis joystick. I want to move one servo with the left/right motion and the other with the up/down motion of the stick. I used the Two_Servo_Assembly.spin object. After downloading the program, there is about a 53 second delay before the servo starts responding. If I download the Two_Servo_Assembly.spin, the servo starts immediately with the demo positions included. Can anyone tell me why there is a delay when I use it in my program? I am using MCP3202x.spin running in another cog to read the ADC on the joystick output.

Comments

  • TimmooreTimmoore Posts: 1,031
    edited 2010-06-17 02:02
    The 2nd instruction is pasm reads position1 this will still be 0 the 1st time, since it has not been written yet, so the first wait will need to wait for cnt to wrap to the original value causing the delay
  • GreenTHHNGreenTHHN Posts: 11
    edited 2010-06-17 02:46
    Ok, thanks. I added "Position1 := Position2 := 121_000" as the first line of the Main routine and it works right away now. This sets the servos to an initial position roughly in the center position.
Sign In or Register to comment.