Shop OBEX P1 Docs P2 Docs Learn Events
Controlling your servo — Parallax Forums

Controlling your servo

NewzedNewzed Posts: 2,503
edited 2005-03-21 18:35 in BASIC Stamp
There have been several post from Stampers just learning about their servo.

Here are a couple of little program to help you learn about controlling·your servo.· The programs are for a BS2, and it is assumed you have a continuous rotation servo.· It also assumes the servo and BS2 are connected to your·PC with a serial cable - you could not use this program as written for a BoeBot.

First, in order to accurately control your servo, you need to know the center of the "OFF" position.· The OFF position is the position where no movement of the servo occurs.· This can be anywhere from 745 to 755, depending on your particular servo.

Load the Servo Setup program and run it.· When the screen asks you for a pulse width, enter 760 and press enter.· The servo should rotate slowly.· Keep decreasing the pulse width by 1 until the servo is not moving.· Record your pulse width as "Upper limit".· Now enter 740.· The servo will rotate slowly in the opposite direction.· Increase your pulse by 1 each time until the servo does not rotate.· Record your pulse width as "Lower limit".· Add the upper and lower limits and divide by two.·
round off the result and use this pulse width as the center "OFF" position.

Now load the Servo Control program.· Replace the "748" in Lines 64 and 69 with your new "OFF" pulse width.· Reload the program and run it.· Just follow the screen options and watch your servo.· Each servo command, regardless of the speed or direction, will rotate about two revolutions.· Attach a horn with a white dot on one of the fingers to the servo shaft so you can follow the servo's rotation.

Have fun!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Sid Weaver
NEW! 4 MB EEPROM

http://hometown.aol.com/newzed/page4.html
Sign In or Register to comment.