oServoSP2 Object
An Object that uses URCP speed values to control a modified servo.
Description:
 

A Hardware Object that controls the speed of a RC servo-motor that has been modified for continuous rotation by outputting a Pulse-Coded PWM signal that is coded for URCP Speed values.

Operation:
 

An oServoSP2 Object rotates a modified RC servo motor connected to the I/O Line specified by the IOLine property at a speed specified by the Value, and InvertOut properties by outputting a Pulse-Coded PWM servo control signal. 

The IOLine property specifies which one of the OOPic's 31 digital I/O Lines is to be used. 
NOTE: The IOLine property MUST be set before the Operate property is set to 1.

When the Value property is set to 0, no pulses are issued to the servo which results in the servo being at rest.  As the Value property increases, more forward pulses are issued to the servo which causes it to move forward increasing in speed as the value approaches 127.  And as the Value property decreases, more reverse pulses are issued to the servo which causes it to move in reverse increasing in speed as the value approaches -128.

The Pulse-Coding is done by evenly distributing and issuing the PWM pulse at a rate of ((Value+1) pulses every 3.6 seconds.  For example; a Value of 1 will issue 2 control pulses every 3.6 seconds which evenly distributes to 1 control pulse every 1.8 seconds.  A value of 63 will issue 64 control pulses every 3.6 seconds which evenly distributes to 17.7 control pulses every second.  And a value of 127 will issue 128 control pulses every 3.6 seconds which evenly distributes to 35.5 control pulses every second. 

When the Operate property is set to 1, the oServoSP2 Object will continuously output a Pulse-Coded PWM servo control pulse to the I/O Line specified by the IOLine  property. This results in the modified RC servo rotating at the specified rate. When the Operate property is cleared to 0, the oServoSP2 Object sets the specified I/O line to 0 volts.

The InvertOut property causes the servo to move in the opposite direction.

Storage size & Availability:
 

The following table lists the size and availability of the oServoSP2 Object:

ObjectSizeVersion
oServoSP2 6 Bytes B.2.0
Properties:
 

The following table lists the Properties of the oServoSP2 Object:

Property Description
Address

Returns a pointer to the address of the oServoSP2 Object instance.

Data-Type: Address, Read-Only

Data-Range: 0 - 127

InvertOut

A value that specifies if the output pulse is reversed.

Data-Type: Bit, Flag

Data-Range: 0 - 1

IOLine

A value that specifies the physical I/O Line to use.

Data-Type: Byte

Data-Range: 0 - 31

Operate

A value that specifies whether or not the pulse is outputted.

Data-Type: Bit, Flag

Data-Range: 0 - 1

Value

The value specifying the position of the servo-motor.

Data-Type: Byte, Default

Data-Range: -128 to +127

Example:
In the following example, a Servo is moved back and forth.
'This program 
Dim S As New oServoSP2

Sub Main()
  S.IOLine = 1
  S.Operate =cvTrue
  Do
   S = 0:   OOPic.delay = 150
   S = 31:  OOPic.delay = 150
   S = 0:   OOPic.delay = 150
   S = -31: OOPic.delay = 150
  Loop
End Sub
Connections:
A RC Servo requires only one I/O Line connection to the OOPic.  It is absolutely necessary that the servo be driven by a different power source than the one that the OOPic is using AND that the ground of each power supply be connected together.
See Also:
oServo - Another Object that drives a servo that is less sophisticated and uses less memory.
oServoX - An Object that uses URCP Heading values to control an RC Servo.
oServoSE - An Object that controls a Scott Edwards mini ssc II servo controller module.