An oKnob 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 0 to 255. When the knob is turned all the way towards the side that is connected to ground then the position reads 0. When the knob is turned all the way towards the side connected to 5 volts, the position reads 255. And when the knob is in the center the position reads 128.
The IOLine property specifies the I/O line that will be used to read the position.
The A2D property is an instance of the oA2D8 object which is created when the oKnob object is. The oKnob object configures the A2D8 object in such a way that it can read the potentiometer's position. Attributes of the oA2D8 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 oA2D8 object for more detail)
' This program reads a knob
' and sets a 7-segment display.
Dim D As New o7Seg
Dim K As New oKnob
Sub Main()
K.IOLine = 1
K.Operate = cvOn
D.IOGroup = 3
D.Operate = cvOn
Do
D.Value = K.Position / 27
Loop
End Sub
// This program reads a knob
// and sets a 7-segment display.
o7Seg D = New o7Seg;
oKnob K = New oKnob;
Void Main(Void){
K.IOLine = 1;
K.Operate = cvOn;
D.IOGroup = 3;
D.Operate = cvOn;
Do {
D.Value = K.Position / 27;
} While (1);
}
Basic Syntax
' This program reads a knob
' and sets a 7-segment display.
D As o7Seg(3,,cvOn)
K As oKnob(1,cvOn)
Do
D.Value = K.Position / 27
Loop