Component: Switch Template (Switch)

From Flowcode Help
Jump to navigationJump to search
Author Matrix Ltd
Version 1.1
Category Switch


Switch Template component

Base single pin switch with no graphical interface Suitable for building your own switches with custom graphics. If the parent component has properties 'pin', 'polarity', 'debounce' and/or 'operation', they will automatically be forwarded to the base component.

Component Source Code

Please click here to download the component source project: FC_Comp_Source_Switch.fcfx

Please click here to view the component source code (Beta): FC_Comp_Source_Switch.fcfx

Detailed description

No detailed description exists yet for this component

Examples

No additional examples






Macro reference

ReadState

Fc9-comp-macro.png ReadState
Reads the button state as 0 for released or 1 for pressed Performs debounce if required 
Fc9-u8-icon.png - BYTE Return


WaitUntilHigh

Fc9-comp-macro.png WaitUntilHigh
Waits until the switch is in state 'high' The interpretation of 'high' depends on the polarity 
Fc9-void-icon.png - VOID Return


WaitUntilLow

Fc9-comp-macro.png WaitUntilLow
Waits until the switch is in state 'low' The interpretation of 'high' depends on the polarity 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png Connections
Fc9-type-5-icon.png Connection
The chip pin to which the switch connects. 
Fc9-type-16-icon.png Polarity
Set the polarity of states sent to the chip pin. 'Active High' -> Pressed = On, Released = Off 'Active Low' -> Pressed = Off, Released = On 
Fc9-type-14-icon.png Debounce (ms)
Sets the time in milliseconds to allow a pin change to settle into a stable state. NB) Debouncing is only used when reading the button state using the component macros. Chip pins are NOT debounced. 
Fc9-conn-icon.png Simulation
Fc9-type-17-icon.png Moving part
Sets a panel object or group to be the moving part of the switch model. Make sure that the object is in the 'Off' position at the time of linking. 
Fc9-type-17-icon.png Pivot object
When using the 'Rotary' switch type, the 'Moving part' will rotate about the object set here. The moving part will rotate around its own axes if this property is left 'Unconnected'. 
Fc9-type-16-icon.png Type
Sets whether the motion of the 'Moving part' will be 'Push/Slide' (linear motion) or 'Rotary' (e.g. toggle switches). 
Fc9-type-16-icon.png Operation
'Latching' = click to turn on, click again to turn off. 'Momentary' = click to turn on, release to turn off. 
Fc9-type-16-icon.png Axis
For 'Push/Slide' switches, the axis that the 'Moving part' will move along. For 'Rotary' switches, the axis around which 'Moving part' will rotate. 
Fc9-type-15-icon.png Movement
For 'Push/Slide' switches, the distance (in local units) to move along the axis. For 'Rotary' switches, the angle (in degrees) to rotate around the axis. 
Fc9-type-7-icon.png Notify on change
When enabled, a 'System.User' event will be sent for each change of switch state. The event is sent to the 'parent' component in which this 'Swict base' instance is used.