owiButtonEnableLED (Function)

Top  Previous  Next

Architecture:

X32 / NX32 / NX32L

Device support:

All devices with 1-Wire except CX1

Firmware version:

1.00 / 1.00.00


owiButtonEnableLED enables use of the LED placed inside the iButton reader. The LED is turned on and off with the owiButtonSetLED function. Before the state can be controlled, owiButtonEnableLED must be set to "on".

 

 

Input:                

enable : BOOL

This enables or disables the use of the LED on the iButton reader.

 

Returns: INT

0

- Successful.

-1

- 1-Wire not supported on target.

 

Declaration:

FUNCTION owiButtonEnableLED : INT;
VAR_INPUT
  enable : BOOL;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
VAR
  iButtonID : STRING;
END_VAR;
 
PROGRAM test;
 
  // Enable use of I-Button Led
  owiButtonEnableLED( enable := ON );
BEGIN
  ...
  // Get I-Button ID
  iButtonID := owiButtonGetID();
  // Was a I-Button present?
  IF strLen(str:=iButtonID) = 12 THEN
    // Valid I-Button ID is 12 characters long (000008F5E179)
    // Turn I-Button LED on to show that I-Button ID has been read
    owiButtonSetLED( state := ON );
     ...
    // Turn I-Button LED off
    owiButtonSetLED( state := OFF );
  END_IF;
  ...
END;
 
END_PROGRAM;