Description: |
| | A Hardware Object that reads a group of 4 bumper switch inputs and returns a URCP Heading value indicating the direction of the impact. |
| | The following table lists the size and availability of the oBumper4 Object.
| | Object | Size | Description | A1 | A2 | B1 | B2 | C1 |
 | oBumper4 | 4 Bytes | Reads a 4-contact bumper. | x | x | x |
|
Operation: |
| | The oBumper4 Object uses 4 I/O lines specified by the IOPack property to read a group of 4 bumper switches. It converts the reading to a URCP Heading value indicating the direction of the impact which is then stored in the Heading property. If any two adjacent bumper switches are pressed at the same time, the Heading property is adjusted to a URCP value indicating that the impact was located between the two bumper switches. When any one of the 4 bumper switches or two adjacent bumper switches are pressed, the Bumped property will be set to 1 and when all 4 bumper switches are not are pressed or two or more non-adjacent switches are pressed, the Bumped property is cleared to 0. When created, the oBumper4 Object also creates an instance of the oOrbitSwitch4 object which it uses to read the 4 I/O lines and generate the Heading value. Modifying any of the properties of the oOrbtSwitch4X Object instance will affect the oBumper4 Object's operation. See the oOrbitSwitch4 for more detail on how the 4 I/O lines are read. |
Properties: |
| | The following table lists the properties of the oBumper4 Object:
|
Examples: |
| | In the following example, the oBumper4 Object is used.
| Visual Basic Syntax | C and Java Syntax |
' This program reads a 4 switch
' bumper, displays the binary
' URCP value on I/O Lines
' 24 - 31 and the Received
' property on I/O line 7.
Dim A As New oBumper4
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 = 21
C.Direction = cvOutput
Do
B.Value = A.Value
C.Value = A.Received
Loop
End Sub | // This program reads a 4 switch
// bumper, displays the binary
// URCP value on I/O Lines
// 24 - 31 and the Received
// property on I/O line 7.
oBumper4 A = New oBumper4;
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 = 21;
C.Direction = cvOutput;
Do{
B.Value = A.Value;
C.Value = A.Received;
} While (1);
} |
| Basic Syntax | |
' This program reads a 4 switch
' bumper, displays the binary
' URCP value on I/O Lines
' 24 - 31 and the Received
' property on I/O line 7.
A Var oBumper4(5,cvOn)
B Var oDIO8(3,cvOutput)
C Var oDIO1(21,cvOutput)
ooPIC.PullUp = 1
1:
B.Value = A.Value
C.Value = A.Received
Goto 1 | |
|
Connections: |
| | The oBumper4 uses 4 I/O lines. These 4 I/O lines must be 4 contiguous I/O lines starting with I/O line 8, 12, 16, 20, 24, or 28. The inputs are active low and each of the 4 I/O lines will require a pull up resister. If the I/O lines starting with 8 or 12 are selected, the internal pull up resisters can be used by setting the ooPIC.PullUp property to 1. The 4 I/O lines are used for the 4 four switches; Front, Left, Back and Right.
| Switch Position | Typical wiring for each switch |
 |  |
| IOPack: | 1 | 2 | 3 | 4 | 5 | 6 | 7 | Switch Location |
| I/O 0: | 8 | 16 | 24 | 5 | 12 | 20 | 28 | Front |
| I/O 1: | 9 | 17 | 25 | 6 | 13 | 21 | 29 | Left |
| I/O 2: | 10 | 18 | 26 | 7 | 14 | 22 | 30 | Back |
| I/O 3: | 11 | 19 | 27 | - | 15 | 23 | 31 | Right |
|
Caution: IOPack 2 and 6 contain special purpose I/O such as Debugging, Serial Port & PWM. Do not use these I/O Lines if they are in use by the other functions. |
Related Items: |
| | The following table lists objects with related functions
| | Object | Description | A1 | A2 | B1 | B2 | C1 |
 | oBumper8 | Reads an 8-contact bumper. | x | x |
|
Version History and Bug List: |
| | Firmware Ver B1: Introduced. Bugs: No known bugs. |