Component: Reed Switch (Sensors)

From Flowcode Help
Jump to navigationJump to search


Author Matrix Ltd
Version 1.2 (Release)
Category Sensors


Image Reed Switch component

Simple on off switch triggered by the proximity of another object.

Examples

No additional examples


Downloadable macro reference

ReadState

Get the current collision state.

The 'Polarity' property will affect whether a collision is represented by a high

or low state.

Parameters

This macro has no parameters


Return value

BYTE


WaitUntilHigh

Pause the program until the detector goes high.

'Polarity' will affect whether high value represents a collision or separation.

NB) In simulation, only use this macro if testing for collision with animated or

timer driven objects!!

Parameters

This macro has no parameters


Return value

This call does not return a value


WaitUntilLow

Pause the program until the detector goes low.

'Polarity' will affect whether low value represents a collision or separation.

NB) In simulation, only use this macro if testing for collision with animated or

timer driven objects!!

Parameters

This macro has no parameters


Return value

This call does not return a value


Simulation macro reference

SetTarget

Set the object that you want to test for collision with.

If this is not called, or is called with handle = 0, collisions will be tested against

every panel object that has 'Solid' status.

NB) Specifying an object will save CPU power!!

Parameters

HANDLE Target
The object to test for collision with.


Return value

This call does not return a value



Property reference

Pin

This property is of type Single digital pin and can be referenced with the variable name pin.

The chip pin that will receive the switch status.

Polarity

This property is of type Fixed list of ints and can be referenced with the variable name polarity.

Select the pin state that will indicate that an object has been detected.

Magnet Object

This property is of type Panel object and can be referenced with the variable name target.

Select an object from the panel to act as the magnet that triggers the reed switch.

Range

This property is of type Floating point and can be referenced with the variable name range.

Distance within which the switch is activated.

NB) This is measured between the centre of the proximity switch and the centre of the target object.

Timer Interval (ms)

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

Time in milliseconds between testing for proximity.

Small time = Greater CPU load

Large time = More like to miss activation if it is very brief.