oIRPD Object

Main Index
Object List
Back to top of page Description:
 

The oIRPD Object is a Hardware Object that reads an Infrared Proximity Detector (IRPD) to see if there are any obstacles in front of it.  An IRPD provides a "no contact" obstacle detection system.

The oIRPD Object calculates a value based on the detection of obstacles in three separate quadrants.  Front, Right, and Left.

 The following table lists the size and availability of the oIRPD Object.
 ObjectSizeDescriptionA1A2B1B2C1
oIRPD5 BytesReads a Lynxmotion Dual IR Proximity Detector.xx
oIRPD25 BytesReads a Lynxmotion Dual IR Proximity Detector. (same as oIRPD)xx
Back to top of page Operation:
 

An oIRPD Object uses 3 I/O Lines to read a Infrared Proximity Detector.

When the Operate property is set to 1, the Infrared Proximity Detector is scanned to see if there are any obstacles in front of it.  After scanning, a value indicating the reflection state is calculated. 

The four oLogic properties; Center, Left, Right and Detected are also update each time the reflection state is determined.  The three properties; Center, Left and Right are exclusive and only one will be true at any time, while the Detected property is true if the Position property is any value other than 0 which indicates that the light from either or both of the IR LEDs is being reflected.

The FeedBack property is an instance of the oFeedBack2 Object which is created when the oIRPD Object is.  The oIRPD Object uses the oFeedBack2 Object to do the actual control of the IRPD and when the oIRPD object is created, it configures the oFeedBack2 object in such a way that it will provide the proper I/O control to read the Lynxmotion IRPD Module.  (see oFeedBack2 Object for more detail on how the IRPD is read.)

Back to top of page Properties:

The following table lists the properties of the oIRPD Object:

Property

Description

Position
A value that indicates the position of the item the detector sees.
Object Class: oValue Value Range:0 - 3
Data Type: Numeric Default Value: 0
PositionDescription
0Nether of the IR LEDs are reflecting back to the IR sensor.
1The light from just the left IR LED is reflecting back to the IR sensor.
2The light from just the right IR LED is reflecting back to the IR sensor.
3The light from both IR LEDs are reflecting back to the IR sensor.
Detected
A value that indicates if the detector sees an item.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
Left
A value that indicates if the detector sees an item to the left side.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
Centered
A value that indicates if the detector sees an item to the front.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
Right
A value that indicates if the detector sees an item on the right side.
Object Class: oLogic Value Range: 0 - 1
Data Type: Numeric Default Value: 0
IOLineL
A value that specifies which I/O Line is connected to the left side IR LED connection.
Object Class: oIOLine Value Range: 0 - 31
Data Type: Numeric Default Value: 0
Some I/O Lines have special purposes.  Be sure to see oIOLine help file for details.
IOLineR
A value that specifies which I/O Line is connected to the right side IR LED connection.
Object Class: oIOLine Value Range: 0 - 31
Data Type: Numeric Default Value: 0
Some I/O Lines have special purposes.  Be sure to see oIOLine help file for details.
IOLineS
A value that specifies which I/O Line is connected to the IR Sensor connection.
Object Class: oIOLine Value Range: 0 - 31
Data Type: Numeric Default Value: 0
Some I/O Lines have special purposes.  Be sure to see oIOLine help file for details.
Operate
A value that selects whether or not the detector is being read.
Object Class: oOperate Value Range: 0 - 1
Data Type: Numeric Default Value: 0
OperateConstantDescription
0cvOffThe detector is not read.
1cvOnThe detector is read.
FeedBack
The I/O function object used to read the Lynxmotion IRPD.
Object Class: oFeedBack2 Value Range: 0 - 255
Data Type: Numeric Default Value: 0
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

Back to top of page Examples:
 In the following example, the oIRPD Object is used to read a Lynxmotion IRPD.
Visual Basic Syntax C and Java Syntax
'This program creates an oIRPD Object.
'It then uses 4 oWire Objects to copy
'the left, right and center property 
'values to LEDs to show the results
'of the IRPD.

Dim A As New oIRPD

Dim WL As New oWire
Dim LedL As New oLED
Dim WC As New oWire
Dim LedC As New oLED
Dim WR As New oWire
Dim LedR As New oLED
Dim WF As New oWire
Dim LedD As New oLED

Sub Main()
  A.IOLineL = 7
  A.IOLineR = 6
  A.IOLineS = 5
  A.Operate = 1
  LedL.IOLine = 29
  LedL.Brightness = 7
  WL.Input.Link(A.Left)
  WL.Output.Link(LedL.Operate)
  WL.Operate = 1
  LedC.IOLine = 30
  LedC.Brightness = 7
  WC.Input.Link(A.Center)
  WC.Output.Link(LedC.Operate)
  WC.Operate = 1  
  LedR.IOLine = 28
  LedR.Brightness = 7
  WR.Input.Link(A.Right)
  WR.Output.Link(LedR.Operate)
  WR.Operate = 1  
  LedD.IOLine = 31
  LedD.Brightness = 7
  WF.Input.Link(A.Detected)
  WF.Output.Link(LedD.Operate)
  WF.Operate = 1  
End Sub
// This program creates an oIRPD Object.
// It then uses 4 oWire Objects to copy
// the left, right and center property
// values to LEDs to show the results
// of the IRPD.

oIRPD A = New oIRPD;

oWire WL = New oWire;
oLED LedL = New oLED;
oWire WC = New oWire;
oLED LedC = New oLED;
oWire WR = New oWire;
oLED LedR = New oLED;
oWire WF = New oWire;
oLED LedD = New oLED;

Void Main(Void){
  A.IOLineL = 7;
  A.IOLineR = 6;
  A.IOLineS = 5;
  A.Operate = 1;
  LedL.IOLine = 29;
  LedL.Brightness = 7;
  WL.Input.Link(A.Left);
  WL.Output.Link(LedL.Operate);
  WL.Operate = 1;
  LedC.IOLine = 30;
  LedC.Brightness = 7;
  WC.Input.Link(A.Center);
  WC.Output.Link(LedC.Operate);
  WC.Operate = 1;
  LedR.IOLine = 28;
  LedR.Brightness = 7;
  WR.Input.Link(A.Right);
  WR.Output.Link(LedR.Operate);
  WR.Operate = 1;
  LedD.IOLine = 31;
  LedD.Brightness = 7;
  WF.Input.Link(A.Detected);
  WF.Output.Link(LedD.Operate);
  WF.Operate = 1;
}
Basic Syntax
'This program creates an oIRPD Object.
'It then uses 4 oWire Objects to copy
'the left, right and center property 
'values to LEDs to show the results
'of the IRPD.

Dim A As New oIRPD(7,6,5,cvOn)

Dim WL As New oWire(A.Left,,LedL.Operate,,cvOn)
Dim LedL As New oLED(29,7,,cvOff)

Dim WC As New oWire(A.Center,,LedC.Operate,,cvOn)
Dim LedC As New oLED(30,7,,cvOff)

Dim WR As New oWire(A.Right,,LedR.Operate,,cvOn)
Dim LedR As New oLED(28,7,,cvOff)

Dim WF As New oWire(A.Detected,,LedD.Operate,,cvOn)
Dim LedD As New oLED(31,7,,cvOff)
Back to top of page Connections:
The Lynxmotion IRPD uses 3 I/O lines.  Any of the three can be any 3 I/O lines of the ooPIC's 31 I/O lines.  The IRPD uses a 9 volt power input to operate. 
Lynxmotion IRPD
PinNameDescriptionI/O NameooPIC
I/O Line
1,2+9v+9 Volts power +V
3LLEDLeft IR LED controlIOLineLAny
4RLEDRight IR LED controlIOLineRAny
5SOUTIR Sensor OutIOLineSAny
6+5v+5 Volts power  
7,8GndGround Gnd

Back to top of page Related Items:

 The following table lists objects with related functions
 ObjectDescriptionA1A2B1B2C1
oIRPD1Reads a Lynxmotion IR Proximity Detector.xxxxx
oIRRangeReads a Sharp GP2D12 IR ranging module.xxx
Back to top of page Version History and Bug List:
 Firmware Ver B2: Introduced.

Bugs: No known bugs.


ooPIC Compiler Ver 6.0 (c) Copyright 1997 - 2007 Savage Innovations, LLC.