oUserClass Object

Back to top of page Description:
 A User Defined Object is an Object that is made by declaring a user program as an Object.
 The following table lists the size and availability of the oUserClass Object.
 ObjectSizeDescriptionA1A2B1B2C1
oUserClass An Object created from an ooPIC program.xxxxx
Back to top of page Operation:
 When a user program is declared in a oUserClass Object's argument list, the user program compiles into the calling program as if it was an Object. 

All of the user program's Objects are created and the user program's Main procedure is called at the time that the oUserClass is created.  All other procedures become methods of the Object.

All of the user program's Object's properties are accessible by stating the User Class name followed by a period and then the user program's Object and property in normal format.

NOTE: When specifying the filename of the user class, the file path is assumed to be the same as the calling program.  If the actual path is different, then the full path will need to be given.

Back to top of page Example:

 The following examples use the oUserClass Object.
 User-ClassProgram that uses the User-Class
'This program operates 
'two oDCMotor Objects.
'saved as "Sample-U.osc"

Dim Right As New oDCMotor
Dim Left As New oDCMotor

Sub Main()
  Right.IOLineP = 17
  Right.Operate = 1
  Left.IOLineP = 18
  Left.Operate = 1
End Sub

Sub Forward()
  Right.Speed = 50
  Left.Speed = 50
End Sub

Sub Backward()
  Right.Speed = -50
  Left.Speed = -50
End Sub

Sub Stop()
  Right.Speed = 0
  Left.Speed = 0
End Sub
'This program uses a user 
'program as an Object
'named "Robot".

Dim Robot As New oUserClass("Sample-U.osc")


Sub Main()
  Robot.Right.Speed = 50
  Robot.Left.Speed = -50
  ooPIC.Delay = 200
  Robot.Forward
  ooPIC.Delay = 200
  Robot.Backward
  ooPIC.Delay = 200
  Robot.Stop
End Sub
Back to top of page Version History and Bug List:
 Firmware Ver A1: Introduced.

Bugs: No known bugs.


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