Traffic light

The described widget is suitable for displaying a traffic light in the app. The various configuration options are described below. In the figure all available features of the widget are active.

Traffic light 1:

The widget is transferred as a substructure in the overall structure of the SendData() method. To build the widget, various PLC attributes are used when declaring the structure.

{attribute 'iot.ReadOnly' := 'false'}
{attribute 'iot.DisplayName' := 'Name for Widget'}
{attribute 'iot.WidgetType' := 'TrafficLight'}
{attribute 'iot.ModeVisible' := 'true'}
{attribute 'iot.ModeChangeable' := 'true'}
stTrafficLightWidgetSample : ST_TrafficLightWidgetSample;

Attribute

Data type

Description

iot.ReadOnly

BOOL

Determines whether the widget on the app side gets only read access (TRUE) or also additional write access to the PLC (FALSE).

iot.DisplayName

STRING

The display name of the widget in the app. This will be overwritten by sDisplayName as soon as sDisplayName is not an empty string.

iot.WidgetType

STRING

Type specification for the widget, in this case: TrafficLight.

IoT.ModeVisible

BOOL

Determines whether the mode is displayed (TRUE) or not (FALSE).

IoT.ModeChangeable

BOOL

Determines whether the mode is adjustable (TRUE) or not (FALSE).

TYPE ST_TrafficLightWidgetSample :
STRUCT
    sDisplayName    : STRING := '';
    nError          : USINT;
    bRedOn          : BOOL;
    bYellowOn       : BOOL;
    bGreenOn        : BOOL;
    sMode           : STRING := 'Automatic';
    aModes          : ARRAY[0..1] OF STRING := ['Manual', 'Automatic'];
END_STRUCT
END_TYPE

Attribute

Data type

Description

Display in widget

sDisplayName

STRING

Determines the display name of the widget and overwrites the PLC attribute 'iot.DisplayName'.

Display text of the widget.

nError

USINT

Determines whether the widget is in an error state.
0 - No error
1 - Warning
2 - Error
3 - Critical error

Between icon and display name of the widget.

bRedOn

BOOL

Switches the red light of the traffic light on (TRUE) or off (FALSE).

On the right of the three circles.

bYellowOn

BOOL

Switches the yellow light of the traffic light on (TRUE) or off (FALSE).

In the middle of the three circles.

bGreenOn

BOOL

Switches the green light of the traffic light on (TRUE) or off (FALSE).

On the left of the three circles.

sMode

STRING

Mode of the traffic light.

The currently displayed mode.

aModes

ARRAY [0..n] OF STRING

Array of the different modes that can be set by the user.

By pressing on the current mode, the adjustable modes can be displayed.