| | An oButton Object continuously cycles between controlling one of two different objects each of which share a single I/O line. The first functions as a digital Input which reads a push-button style switch and the second functions as a digital output which controls an LED. In order for both the LED and the push button to be connected to the same I/O line, they Must be connected to the I/O line through a resister as indicated by the wiring diagram in the Connection section. In the first half of the cycle, when operating as a digital Input, the oDIO1RW Object (DIO property) is used to read the position of a switch. The Position property is set depending on the combination of the state of the switch and the Mode property. If the Mode property is set to 0, then the push button is treated as a regular push button where pressed is on, and released is off. If the Mode property is 1, then the push button is treated as a toggle switch where pressed once is on and pressed a second time is off. In both modes, changing from off to on or on to off sets the Position property accordingly. Note that the Position property is only modified when the push button physically changed state. This allows the application program to preset the Position property or to change it after it has been set by the user's interaction. In the second half of the cycle, when the oButton is operating as a digital Output, the oLEDB Object (LED property) is used to control an LED. the Position property is used to specify whether or not the LED is on or off. If 1, then the LED is turned on and if 0, then the LED is turned off. Some of the properties of the oLED Object can be changed without interfering with the oButton's control. For instance, the LED.Blink property changes the appearance of the LED when it is on. If LED.Blink is set to 0, then the LED glows continuously. However, LED.Blink is 1 or more, then the LED blinks in various ways. (See the oLEDB Object for more detail) In normal operation, the Position property controls the state of the LED. By setting the Option property to 1, this control can be turned off. Note that when the Position property is in control, the oLEDB Object's Operate property is over-ridden by the oButton's Position property and therefore has no effect. However, by setting the Option property to 1, the oLEDB Object's Operate property regains control. |