Jump to content

Component: Traffic Light 2-Way (Scenarios)

From Flowcode Help
Revision as of 14:21, 13 July 2026 by SteveT (talk | contribs) (Text replacement - "width="10%" align="center" style="background-color:#D8C9D8;"" to "width="10%" align="center" class="mtx-class-macrohead"")
Author Matrix TSL
Version 1.0
Category Scenarios


Traffic Light 2-Way component

A set of two 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.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_TrafficLight-2Way.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_TrafficLight-2Way.fcfx

Detailed description

No detailed description exists yet for this component

Examples

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

Traffic Light Scenario






Macro reference

AutomaticMode

AutomaticMode
Enables or Disables automatic mode where the lights will automatically cycle between modes. 
- BOOL Mode
0 = Auto Mode Disabled, 1 = Auto Mode Enabled 
- VOID Return


GetLightState

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 
- BOOL LightSet
0 = Light Set 1, 1 = Light Set 2 
- BYTE Return


GetStopGo

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. 
- BOOL LightSet
0 = Light Set 1, 1 = Light Set 2 
- BOOL Return


SetLightState

SetLightState
Follows the standard traffic light sequence. 
- BOOL LightSet
0 = Light Set 1, 1 = Light Set 2 
- BYTE SequenceNumber
0 = Red, 1 = Red+Amber, 2 = Green, 3 = Amber 
- VOID Return


SetLights

SetLights
Direct control over all 6 of the lights. 
- BOOL Red0
0 = Off, 1 = On 
- BOOL Amber0
0 = Off, 1 = On 
- BOOL Green0
0 = Off, 1 = On 
- BOOL Red1
0 = Off, 1 = On 
- BOOL Amber1
0 = Off, 1 = On 
- BOOL Green1
0 = Off, 1 = On 
- VOID Return


SetSingleLight

SetSingleLight
Direct control over one set of lights. 
- BOOL LightSet
0 = Light Set 1, 1 = Light Set 2 
- BOOL Red
Red - 0 = Off, 1 = On 
- BOOL Amber
Amber - 0 = Off, 1 = On 
- BOOL Green
Green - 0 = Off, 1 = On 
- VOID Return


Property reference

Properties
Colours
Red Colour
Colour Picker to set the Colour of the Red indicators when they are switched on. 
Amber Colour
Colour Picker to set the Colour of the Amber indicators when they are switched on. 
Green Colour
Colour Picker to set the Colour of the Green indicators when they are switched on. 
Off Colour
Colour Picker to set the Colour of all indicators when they are switched off. 
Timings - Automatic Mode
Flow Time
Amount of time to wait in milliseconds when the lights are red or green. 
Transition Time
Amount of time to wait in milliseconds when the lights are transitioning between flows.