Description: |
| | An oLight Object is a Hardware Object that controls the brightness of a light. The oLight Object uses a single digital I/O lines to communicate with a driver which handles the voltage and current requirements of the light it is connected to. The brightness of the light is controlled by a single value with a range of 0 to 15. When this value is 0, the light is off. When the value is a number from 1 to 15, the light increases in brightness at a level indicated by the value. The higher the value, the brighter the light is. |
| | The following table lists the size and availability of the oLight Object.
| | Object | Size | Description | A1 | A2 | B1 | B2 | C1 |
 | oLight | 4 Bytes | Controls a light. | x | x | x |
|
Operation: |
| | An oLight Object controls the brightness of a light by outputting a control signal on on the I/O line specified by the IOLine property. The Brightness property controls how bright the light is. To control the brightness of a light, an output control signal turns on and off at a frequency of about 550 Hz causing the light to flash at a rate that is unperceivable to the eye. The duration of the "on" portion of the control signal determines how bright the light will be. This duration is specified by the value of the Brightness property which is expressed as ratio of 15 where 0 is 0%, 7 is 50% and 15 is 100%. That is to say that at 0, the "on" portion of the control signal is 0% of the time. At 50%, the "on" portion of the control signal is 50% of the time and so on. The Operate property specifies if the "on" portion of the control signal is generated. When the Operate property is set to 1, the oLight Object starts generating and outputting the "on" portion at the duration specified by the Brightness property. When the Operate property is set to 0, the "on" portions are are discontinued and the specified I/O Line is set off. The Invert property inverts what is considered the "on" portion of the control signal. When the Invert property is 0, the "on" portion of the control signal is at 5 Volts. When the Invert property is set to 1, the control signal is inverted so that 0 Volts is considered the "on" state. The PWM property is an instance of the oPWML object which is created when the oLight object is. Attributes of the light's operation can be adjusted by directly manipulating the oPWML object. Note that doing so may change the way the light behaves to something different than the way described in this document. (see oPWML object for more detail on how the oPWML Object control the light.) |
Properties: |
| The following table lists the properties of the oLight Object:
Property | Description |
| Brightness |
| A value that specifies the brightness level of the Light. |
 | Object Class: | oNib | | Value Range: | 0 - 15 |
| Data Type: | Numeric | | Default Value: | 0 |
|
| Brightness | Description |
| 0 | The light is off. |
| 1 - 14 | The light is at a brightness level between off and full on. |
| 15* | The light is at full brightness. |
|
| *Bug: A value of 15 does not work in firmware B1 to B2. Fixed in C1. |
|
| Invert |
| A value that selects if the output is inverted. |
| Availability: Added in Firmware C1 |
 | Object Class: | oSelect0to1L | | Value Range: | 0 - 1 |
| Data Type: | Numeric | | Default Value: | 0 |
|
|
| IOLine |
| A value that specifies which I/O Line is used to control the Light. |
 | 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 specifies if the Light is on or off. |
 | Object Class: | oOperate | | Value Range: | 0 - 1 |
| Data Type: | Numeric | | Default Value: | 0 |
|
| Operate | Constant | Description |
| 0 | cvOff | The light is off. |
| 1 | cvOn | The light is on. |
|
|
| PWM |
| The I/O function object used to control the Light. |
 | Object Class: | oPWML | | Value Range: | 0 - 1 |
| 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 |
|
|
|
Example:
|
| The following examples use the oLight Object.
| Visual Basic Syntax | C and Java Syntax |
'This program flashes a light
'at half brightness.
Dim A As New oLight
Sub Main()
A.IOLine = 8
Do
A.Flash(7,1000,1000)
Loop
End Sub | //This program flashes a light
//at half brightness.
oLight A = New oLight;
Void Main(Void){
A.IOLine = 8;
Do{
A.Flash(7,1000,1000)
} While (1);
} |
| Basic Syntax | |
'This program flashes a light
'at half brightness.
A As oLight(8)
Do
A.Flash(7,1000,1000)
Loop | |
|
Connections: |
| If the light used draws any more current than 25ma or operates at more than 5 Volts, or uses a voltage other than 5 Volts, then a driver will need to with the light. The L293D is a driver that can be used. The IOLine property specifies which I/O Line to connect.
| L293D Driver and light. |
 |
|
Related Items:
|
| | The following table lists objects with related functions
| | Object | Description | A1 | A2 | B1 | B2 | C1 |
 | oChaser4 | Controls a series of chasing lights. | B2 | C1 |
 | oLED | Controls an LED light with brightness control. | x | x | x |
|
Version History and Bug List: |
| | Firmware Ver B1: Introduced. Firmware Ver C1: Invert property added.Bugs: Firmware B1 to B2 a DutyCycle of 15 does not work. Fixed in firmware C.1 |