Description: |
| | A Hardware Object that reads the position of a knob attached to a potentiometer and reports the position as a value ranging from -128 to +127. |
| | The following table lists the size and availability of the oKnob Object.
| | Object | Size | Description | A1 | A2 | B1 | B2 | C1 |
 | oKnobX | 5 Bytes | Reads the position of a Knob. | x | x | x |
|
Operation: |
| | An oKnobX Object continuously updates the Position property with the position read from a knob attached to a potentiometer as long as long as the Operate property is set to 1. When the Operate property is cleared to 0, the Position property is no longer updated and thus will not change. The position range is from -128 to +127. When the knob is turned all the way towards the side that is connected to ground then the position reads -128. When the knob is turned all the way towards the side connected to 5 volts, the position reads +127. And when the knob is in the center the position reads 0.The IOLine property specifies the I/O line that will be used to read the position. The A2D property is an instance of the oA2DX object which is created when the oKnob object is. The oKnob object configures the A2DX object in such a way that it can read the potentiometer's position. Attributes of the oA2DX Object's operation can be adjusted by directly manipulating it, but note that doing so may change the way the knob gets read to something different than the way described in this document. (see oA2DX object for more detail) |
Properties: |
| The following table lists the properties of the oKnobX Object:
|
Example:
|
| The following examples use the oKnobX Object.
| Visual Basic Syntax | C and Java Syntax |
'This program reads the position
' of a potentiometer and then sets
' the speed of a DC Motor based
' on that reading.
Dim K As New oKnobX
Dim M As New oDCMotor2
Sub Main()
K.IOLine = 1
K.Operate = 1
M.IOLineP=17
M.IOLine1=24
M.IOLine2=25
M.Operate.TurnOn
Do
M.Speed = K.Position
Loop
End Sub | // This program reads the position
// of a potentiometer and then sets
// the speed of a DC Motor based
// on that reading.
oKnobX K = New oKnobX;
oDCMotor2 M = New oDCMotor2;
Void Main(Void){
K.IOLine = 1;
K.Operate = 1;
M.IOLineP = 17;
M.IOLine1 = 24;
M.IOLine2 = 25;
M.Operate.TurnOn;
Do{
M.Speed = K.Position;
} While (1);
} |
| Basic Syntax | |
'This program reads the position
' of a potentiometer and then sets
' the speed of a DC Motor based
' on that reading.
Dim K As New oKnobX(1,0,cvOn)
Dim M As New oDCMotor2(17,24,25,0,cvOff,cvOff,cvOn)
Sub Main()
Do
M.Speed = K.Position
Loop
End Sub |
|
Connections: |
| | A potentiometer uses one I/O line. The I/O Line is specified by the IOLine property.
| Connections for knob attached to a potentiometer. |
|
|
|
Related Items: |
| | The following table lists objects with related functions
| | Object | Description | A1 | A2 | B1 | B2 | C1 |
 | oKnob | Reads the position of a Knob. | x | x | x | x | x |
|
Version History and Bug List: |
| | Firmware Ver B1: Introduced. Firmware Ver B2: The Adjust property was added.Bugs: No known bugs. |