Description: |
| | The oOrbitSwitch4 Object is an I/O Function Object that reads a group of 4 switch inputs arranged in a circular fashion and calculates a value based on which side of the circle the switches are closed. |
| | The following table lists the size and availability of the oOrbitSwitch4 Object.
| | Object | Size | Description | A1 | A2 | B1 | B2 | C1 |
 | oOrbitSwitch4 | 4 Bytes | Reads a circular array of 4 switches. | x | x |
|
Operation: |
| | The oOrbitSwitch4 Object uses 4 I/O lines specified by the IOPack property to read a group of 4 switches arranged like the points of a compass. Based on which switch is closed, a Heading value is calculated that indicates the general direction of the closed switch. In addition, if any two adjacent switches are pressed at the same time, the Heading value will indicate the direction of a point between the two switches. The Value that is calculated for the Heading is based on URCP Heading values. When any one of the 4 switches or two adjacent switches are closed, the Pressed property will be set to 1 and when all 4 switches are not closed, the Pressed property is cleared to 0. |
Properties: |
| | The following table lists the properties of the oOrbitSwitch4 Object:
Property | Description |
| Heading |
| A value that indicates the current heading of the direction of the pressed switches. |
 | Object Class: | oHeading | | Value Range: | -128 to +127 |
| Data Type: | Numeric | | Default Value: | 0 |
|
| I/O Inputs | Position | Heading | Pressed |  URCP Heading
|
| 0001 | Front | 0 | 1 |
| 0011 | | 32 | 1 |
| 0010 | Left | 64 | 1 |
| 0110 | | 96 | 1 |
| 0100 | Back | -128 | 1 |
| 1100 | | -96 | 1 |
| 1000 | Right | -64 | 1 |
| 1001 | | -32 | 1 |
| Other | | Unchanged | 0 |
|
|
| Pressed |
| A value that indicates if any of the switches are pressed. |
 | Object Class: | oLogic | | Value Range: | 0 - 1 |
| Data Type: | Numeric | | Default Value: | 0 |
|
|
| IOPack |
| A value that specifies which pack of 4 I/O lines is connected to the switches. |
 | Object Class: | oIOPack | | Value Range: | 0 - 7 |
| Data Type: | Numeric | | Default Value: | 0 |
|
| Some I/O Lines have special purposes. Be sure to see oIOPack help file for details. |
|
| Operate |
| A value that selects whether or not the switches are being read. |
 | Object Class: | oOperate | | Value Range: | 0 - 1 |
| Data Type: | Numeric | | Default Value: | 0 |
|
| Operate | Constant | Description |
| 0 | cvOff | The I/O lines are not read. |
| 1 | cvOn | The I/O lines are read. |
|
|
| Address |
| Returns a pointer to the address of the oCounter Object instance. |
 | Object Class: | oAddress | | Value Range: | 0 - 127 |
| Data Type: | Pointer (Read Only) | | Default Value: | Address of Object |
|
|
| :
|
Examples: |
| | In the following example, the oOrbitSwitch4 Object is used.
| Visual Basic Syntax | C and Java Syntax |
' This program reads a 4 switch
' bumper, displays the URCP
' heading value on I/O Lines
' 24 - 31 and the Received
' property on I/O line 7.
Dim A As New oOrbitSwitch4
Dim B As New oDIO8
Dim C As New oDIO1
Sub Main()
ooPIC.PullUp = 1
A.IOPack = 5
A.Operate = cvTrue
B.IOGroup = 3
B.Direction = cvOutput
C.IOLine = 7
C.Direction = cvOutput
Do
B.Value = A.Heading
C.Value = A.Pressed
Loop
End Sub | // This program reads a 4 switch
// bumper, displays the URCP
// heading value on I/O Lines
// 24 - 31 and the Received
// property on I/O line 7.
oOrbitSwitch4 A = New oOrbitSwitch4;
oDIO8 B = New oDIO8;
oDIO1 C = New oDIO1;
Void Main(Void){
ooPIC.PullUp = 1;
A.IOPack = 5;
A.Operate = cvTrue;
B.IOGroup = 3;
B.Direction = cvOutput;
C.IOLine = 7;
C.Direction = cvOutput;
Do{
B.Value = A.Heading;
C.Value = A.Pressed;
} While (1);
} |
| Basic Syntax | |
' This program reads a 4 switch
' bumper, displays the URCP
' heading value on I/O lines
' 24 - 31 and the Received
' property on I/O line 7.
A Var oOrbitSwitch4(5,cvOn)
B Var oDIO8(3,cvOutput)
C Var oDIO1(7,cvOutput)
ooPIC.PullUp = 1
Do
B.Value = A.Value
C.Value = A.Pressed
Loop | |
|
Connections: |
| | See the oBumper4, oCompassDN, or oJoyStick Objects for connection examples. |
Related Items:
|
| | The following table lists objects that use the oOrbitSwitch4 Object.
| | Object | Description | A1 | A2 | B1 | B2 | C1 |
 | oBumper4 | Reads a 4-contact bumper. | x | x | x |
 | oCompassDN | Reads a Dinsmore 1490 Compass. | x | x | x |
 | oJoyStick | Reads an Atari style joystick | x | x | x |
|
| | The following table lists objects with related functions
|
Version History and Bug List: |
| | Firmware Ver B2: Introduced. Bugs: No known bugs. |