| | An oButton Object works like an oDio1 Object that continuously cycles between being an Digital Input which reads a push-button style switch and being 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 at the end of this page. When operating as a Digital Input, the State property is set depending on the state of a connected push button and the InvertIn and Mode properties. 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. If the InvertIn property is set to 1, then the logic behind the State property is reversed as follows: If the Mode property is set to 0, then pressed is off, and released is on and if the Mode property is 1, then released once is on and released a second time is off. In any of these situations, changing from an off state to an on state sets the State property to 1 and changing from an on state to an off state clears the State property to 0. Note that the State property is only modified when the push button physically changed state. This allows the application program to set the State property directly thereby emulating the the push button being physically pressed or released. When operating as a Digital Output, the State property is used to specify whether or not the LED is on. If State is 1, then the LED is turned on and if State is 0, then the LED is turned off. The Style property changed the appearance of the LED when it is on. If Style is set to 0, then the LED glows continuously. If Style is 1, then the LED blinks once a second. If Style is 2, then the LED blinks 4 times a second. And if Style is 3, then the LED blinks twice at four times a second and then remains off for 1/2 a second then repeats. The LED can optionally be disconnected from the push button state and be controlled by a different value. By setting the Option property to 1, the ValueO Property is used to specify whether or not the LED is on. This option can be used in combination with a virtual circuit utilizing other objects such as the oRepeat Object to create Buttons with custom functionality. |