Shop OBEX P1 Docs P2 Docs Learn Events
Question about using the WavePlayerSDAccess and Standard Servo — Parallax Forums

Question about using the WavePlayerSDAccess and Standard Servo

Dan EDan E Posts: 61
edited 2010-11-20 07:55 in Propeller 1
Hi,

I am tryng to use the WavePlayerSDAccess object from the object exchange in my main program. I learned how to list that object in my program from the PE Kit book, but I'm not sure about what command to use in order to access individual WAV files from my within my program.

Secondly, I am also using a standard servo, and I also have the servo controller. I noticed that there is spin code on the bottom of the store's webpage for the servo. If I use that code do I still need the servo controller? also I noticed there several objects in the exchange for servo control, which would be most suitable for the Standard Servo?

I am looking to rotate my servo 10 degrees clockwise and 10 degrees counterclockwise in 1 degree increments, controlled by 2 buttons, one for each direction. After reading several objects I am not sure which variable to change to accomplish this. I understand PWM, but each method seems to involve time in some way, so I would appreciate someones expertise to help point me in the right direction as to the correct variable to change.

Thank you,

Dan E

Comments

  • RaymanRayman Posts: 14,889
    edited 2010-11-20 05:10
    As for the servo control, I use: Servo32v5.spin from Beau of Parallax.
    You can find it in OBEX. It's very easy to use.

    I haven't tried wav player. But, I also have one in OBEX that's easy to use.
  • Dan EDan E Posts: 61
    edited 2010-11-20 07:34
    Thanks, that was helpful, in that first link it seems the step size is controlled dividing the clock frequency, just what i was looking for.
  • RaymanRayman Posts: 14,889
    edited 2010-11-20 07:55
    Here's some code for continuous rotation servos. You just need to call servo.start and then servo.set(). Regular servos work the same way except servo.set() with set the position instead of the speed:
    OBJ
      SERVO : "Servo32v5.spin"
    PUB Servo32_DEMO | temp
        SERVO.Start                 'Start Servo handler
     
     
        Roll(0,0)                  'Force Servo to Center  
        repeat
          waitcnt(cnt+clkfreq*3)
          roll(100,100)
          waitcnt(cnt+clkfreq*3)
          roll(-100,-100)       
          waitcnt(cnt+clkfreq*3)
          roll(0,0)        
          waitcnt(cnt+clkfreq*3)
          roll(100,-100)
          waitcnt(cnt+clkfreq*3)
          roll(-100,100)        
        repeat 
     
    PUB Roll(LeftSpeed,RightSpeed)
        SERVO.Set(RWheel,RCenter+RightSpeed)                  
        SERVO.Set(LWheel,LCenter+LeftSpeed)
    
Sign In or Register to comment.