|
| Home / How To / Hardware |
 | Using Servos with the OOPic Jeff Clayton 17 Oct 2000
|
The hook up is very easy and requires no other components. many servos can
be hooked up to the oopic. I have run 12 servos from one OOPIC. The OOPIC
is nice because you dont need a serial servo controller. The OOPIC is available
from www.acroname.com |
Step 1| code 18 Oct 2000 | To get a servo to continuously rotate, it needs to be modified. if you
dont know how, please check the url link. once you have a modified servo,
connect it to the OOPIC as the wire hook up diagram shows above. once its all
hooked up, your ready to program it. In this example, The servo is connected
to IO line 31. This is very simple code that will get the servo moving. Please play
with this code and see what you can do with it.
Now lets look at code to run the servo
Dim servo1 As New oServo 'sets up the oServo object for PWM output
Sub Main() 'mail program
Call SetUp 'initializes servo function
servo1.Value = 64 'turn servo
End Sub
Sub SetUp()
servo1.IOLine = 31 'pin assignment
servo1.Center = 28 'center point (experiment with this)
servo1.Operate = cvTrue 'turn servo on
End Sub
the servo1.value is the servo control. If this number is 0, it spins clockwise,
if servo1.value is 64, it spins counterclockwise. this is as simple as it gets
in controlling a servo. with two servos as locomotion on a robot, the driver code
is very small. all that needs to be done is change the servo1.value to get the servo
to change operation.
|
| |
|
|