Component: Traffic Light 1 Way (Scenarios)

From Flowcode Help
Jump to navigationJump to search


Author Matrix TSL
Version 1.0 (Release)
Category Scenarios


Image Traffic Light 1_Way component

A set of one way traffic lights complete with manual light control, a simple state machine and an automatic mode to allow the lights to take care of themselves.

Examples

There is a detailed walk through of the scenario detailed at the link below to go with this component.

Traffic Light Scenario

Downloadable macro reference

This component does not contain any downloadable macros

Simulation macro reference

GetStopGo

Reads one of the light sets to determine if it is safe to go through the lights.

Returns 1 for a Green light, otherwise returns 0.

Parameters

This macro has no parameters


Return value

BOOL : Returns true if the operation is a success, else false


AutomaticMode

Enables or Disables automatic mode where the lights will automatically cycle between modes.

Parameters

BOOL Mode
0 = Auto Mode Disabled, 1 = Auto Mode Enabled


Return value

This call does not return a value


GetLightState

Reads the state of one of the light sets.

Returns the state as a number.

0=Red, 1=Red+Amber, 2=Green, 3=Amber, 4=Unknown State

Parameters

This macro has no parameters


Return value

BYTE


SetLights

Direct control over all 3 of the lights.

Parameters

BOOL Red
0 = Off, 1 = On
BOOL Amber
0 = Off, 1 = On
BOOL Green
0 = Off, 1 = On


Return value

This call does not return a value


SetLightState

Follows the standard traffic light sequence.

Parameters

BYTE SequenceNumber
0 = Red, 1 = Red+Amber, 2 = Green, 3 = Amber


Return value

This call does not return a value



Property reference

Red Colour

This property is of type Color picker and can be referenced with the variable name Red.

Colour Picker to set the Colour of the Red indicator.


Amber Colour

This property is of type Color picker and can be referenced with the variable name Amber.

Colour Picker to set the Colour of the Amber indicator.


Green Colour

This property is of type Color picker and can be referenced with the variable name Green.

Colour Picker to set the Colour of the Green indicator.


Off Colour

This property is of type Color picker and can be referenced with the variable name Off.

Colour Picker to set the Colour of all indicators when they are switched off.


Flow Time

This property is of type Unsigned integer and can be referenced with the variable name Flow.

Amount of time to wait in milliseconds when the lights are red or green.


Transition Time

This property is of type Unsigned integer and can be referenced with the variable name Trans.

Amount of time to wait in milliseconds when the lights are transitioning between flows.