Shop OBEX P1 Docs P2 Docs Learn Events
4 servo demo, what am I doing wrong. — Parallax Forums

4 servo demo, what am I doing wrong.

DgswanerDgswaner Posts: 795
edited 2007-11-25 13:25 in Propeller 1
Proto board. onboard power. it's connected correctly I can get it to move.

I had this code working on my DEMO board, but now I can't seem to get it working. it will only move to the angle specified in servo.start anything I do to the repeat loop doesn't effect it at all. I haven't modified the servo4 object at all. I've got to be missing something simple but I can't figure it out. any help would be appreciated. the servo stays on holding the start position.

thanks,
dg


{{ Demonstration of the use of the servo4 object

  08/29/2006 - Bob Belleville first version from scratch

}}

CON

  _CLKMODE = XTAL1 + PLL16X
  _XINFREQ = 5_000_000 

OBJ
  SERVO : "Servo4"

PUB go | unit0

  servo.start(500,11,0,12,0,13,0,14)
  unit0 := 1
  repeat
    servo.move_to(11,500,200)    
    servo.wait(11)              
    servo.move_to(11,1000,200)
    servo.wait(11)
    servo.move_to(11,2200,200)
    servo.wait(11)               'move one at a time
    if unit0                    'cycle unit 0 on and off
      servo.move_to(0,0,0)      'unit 0 no signal
      unit0~
    else
      servo.move_to(0,1000,0)
      unit0~~

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
A complex design is the sign of an inferior designer. - Jamie Hyneman, Myth Buster

Comments

  • DgswanerDgswaner Posts: 795
    edited 2007-11-14 20:32
    Does anyone have working code that I could look at and modify for my application? I'm only going to need to control 4 servos max. so the 32 servo object is overkill.... I think.

    Thanks

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    A complex design is the sign of an inferior designer. - Jamie Hyneman, Myth Buster
  • Paul Sr.Paul Sr. Posts: 435
    edited 2007-11-14 22:28
    I think you should reconsider the "32 servo object"! I just looked it over and I think it looks nice and should help you out.
  • DgswanerDgswaner Posts: 795
    edited 2007-11-14 22:36
    being so new at spin if a little frustrating, like anything. With pbasic I know the common mistakes and can usually figure something out, but I could be staring right at the problem and not know it with Spin. but that's how it goes! This forum is a big help tho. I'll look at the servo 32 object. thanks

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    A complex design is the sign of an inferior designer. - Jamie Hyneman, Myth Buster
  • Paul Sr.Paul Sr. Posts: 435
    edited 2007-11-14 23:22
    Dgswaner said...
    being so new at spin if a little frustrating, like anything. With pbasic I know the common mistakes and can usually figure something out, but I could be staring right at the problem and not know it with Spin. but that's how it goes! This forum is a big help tho. I'll look at the servo 32 object. thanks

    Well, the truth is, I am trailing you significantly in the curve, but I just now had it working with an HB-25 connected to a DC gear reduction motor. Worked out of the box! I think you will like it!
  • Beau SchwabeBeau Schwabe Posts: 6,559
    edited 2007-11-15 01:45
    Thanks Paul!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Beau Schwabe

    IC Layout Engineer
    Parallax, Inc.
  • DgswanerDgswaner Posts: 795
    edited 2007-11-15 04:03
    Well, it took me all of about 3 minutes to get the 32 servo object working. it's pretty slick, I'm still dialing in my limits for full movement but it's up and running!

    Thanks guys

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    A complex design is the sign of an inferior designer. - Jamie Hyneman, Myth Buster

    Post Edited (Dgswaner) : 11/15/2007 7:18:31 PM GMT
  • Paul Sr.Paul Sr. Posts: 435
    edited 2007-11-15 23:42
    Beau Schwabe (Parallax) said...
    Thanks Paul!

    You and Dg are welcome.

    Glad I could help!
  • Glenn IrwinGlenn Irwin Posts: 6
    edited 2007-11-25 08:40
    In your code example, your move_to() and wait() calls should refer to the servo unit (0 - 4) and not the pin number. I made this mistake too. It is not pointed out clearly in the documentation.

    I am also looking to control 4 servos and I started with the Servo4 object then moved up to the Servo32. I have now moved back to the Servo4 object because it seems to be easier to use and I can turn off the servos by setting the angle to 0 (major power savings).

    I just haven't figured out how to turn a servo back on after setting the servo angle to 0 (off)
  • J.A.B.J.A.B. Posts: 13
    edited 2007-11-25 13:25
    Dgswaner said...
    Well, it took me all of about 3 minutes to get the 32 servo object working. it's pretty slick, I'm still dialing in my limits for full movement but it's up and running!

    Thanks guys

    Just remember that using servo signals outside the 1-2ms range for 180 degree movement, are "out of spec". So the limit values for one servo may not work with another. You will also most likely have to calculate a new center timing, after you have found the limits.
Sign In or Register to comment.