Difference between revisions of "Component: Proximity Switch Template (Sensors)"
From Flowcode Help
Jump to navigationJump to search (XML import) |
|||
Line 1: | Line 1: | ||
− | + | {| style="width:50%" | |
− | |||
− | {| | ||
|- | |- | ||
− | | width="20%" style="color: gray;" | Author | + | | width="20%" style="color:gray;" | Author |
| Matrix Ltd | | Matrix Ltd | ||
|- | |- | ||
− | | width="20%" style="color: gray;" | Version | + | | width="20%" style="color:gray;" | Version |
− | | 1.2 | + | | 1.2 |
|- | |- | ||
− | | width="20%" style="color: gray;" | Category | + | | width="20%" style="color:gray;" | Category |
| Sensors | | Sensors | ||
|} | |} | ||
+ | ==Proximity Switch Template component== | ||
+ | Polls a chosen panel object to test it's distance from this component. When the test object is within the detection range, the state of a pin is changed, and a User event generated. Used for building models of reed swicthes and hall sensors. | ||
+ | |||
+ | ==Component Pack== | ||
− | + | SENSORS | |
− | |||
− | |||
− | |||
− | |||
+ | ==Detailed description== | ||
+ | |||
+ | ''No detailed description exists yet for this component'' | ||
==Examples== | ==Examples== | ||
+ | |||
+ | |||
Simple example showing the proximity detector component at work, when a proximity is detected the direction of the motor is reversed. | Simple example showing the proximity detector component at work, when a proximity is detected the direction of the motor is reversed. | ||
{{Fcfile|Detector.fcfx|Detector}} | {{Fcfile|Detector.fcfx|Detector}} | ||
Line 28: | Line 31: | ||
==Downloadable macro reference== | ==Downloadable macro reference== | ||
− | === | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
− | Get the current collision state. | + | |- |
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadState''' | ||
+ | |- | ||
+ | | colspan="2" | Get the current collision state. The 'Polarity' property will affect whether a collision is represented by a high or low state. | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-u8-icon.png]] - BYTE | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | or | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''SetTarget''' | ||
+ | |- | ||
+ | | colspan="2" | 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!! | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" | [[File:Fc9-h32-icon.png]] - HANDLE | ||
+ | | width="90%" | Target | ||
+ | |- | ||
+ | | colspan="2" | The object to test for collision with. | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | |||
− | :'' | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" |
+ | |- | ||
+ | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] | ||
+ | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WaitUntilHigh''' | ||
+ | |- | ||
+ | | colspan="2" | 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!! | ||
+ | |- | ||
+ | |- | ||
+ | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | ||
+ | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | ||
+ | |} | ||
− | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | |
− | + | |- | |
− | :[[ | + | | width="10%" align="center" style="background-color:#D8C9D8;" align="center" | [[File:Fc9-comp-macro.png]] |
− | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''WaitUntilLow''' | |
− | + | |- | |
− | = | + | | colspan="2" | 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!! |
− | + | |- | |
− | + | |- | |
− | + | | width="10%" align="center" style="border-top: 2px solid #000;" | [[File:Fc9-void-icon.png]] - VOID | |
− | + | | width="90%" style="border-top: 2px solid #000;" | ''Return'' | |
− | + | |} | |
− | |||
− | |||
− | |||
− | ' | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | 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!! | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | == | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | : | ||
− | |||
− | |||
− | |||
− | |||
− | |||
Line 109: | Line 91: | ||
==Property reference== | ==Property reference== | ||
− | |||
− | + | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | |
− | + | |- | |
− | The chip pin that will receive the switch state. | + | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]] |
− | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties''' | |
− | + | |- | |
− | + | |- | |
− | + | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]] | |
− | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Connections''' | |
− | Select the state that the switch will take when an object triggers the switch. | + | |- |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-5-icon.png]] | |
− | + | | width="90%" | Pin | |
− | + | |- | |
− | + | | colspan="2" | The chip pin that will receive the switch state. | |
− | The object within the component from which the distance to the target object will be measured. | + | |- |
− | + | | width="10%" align="center" | [[File:Fc9-type-16-icon.png]] | |
− | If not set, the centre of the component as a whole will be assumed. | + | | width="90%" | Polarity |
− | + | |- | |
− | + | | colspan="2" | Select the state that the switch will take when an object triggers the switch. | |
− | + | |- | |
− | + | | width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-conn-icon.png]] | |
− | + | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Simulations''' | |
− | 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. | + | | width="10%" align="center" | [[File:Fc9-type-17-icon.png]] |
− | + | | width="90%" | Datum Object | |
− | + | |- | |
− | + | | colspan="2" | The object within the component from which the distance to the target object will be measured. If not set, the centre of the component as a whole will be assumed. | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-15-icon.png]] | |
− | Choose an object within the component that the user can click on to activate the switch for testing purposes. | + | | width="90%" | Range |
− | + | |- | |
− | + | | colspan="2" | 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. | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-17-icon.png]] | |
− | + | | width="90%" | Mouse Object | |
− | An ID value to identify this particular detector. Will be sent as the 'Ident' value for the notification | + | |- |
− | + | | colspan="2" | Choose an object within the component that the user can click on to activate the switch for testing purposes. | |
− | events sent out so that multiple detectors can be told apart. | + | |- |
− | + | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | |
− | The event value will be 1 for actiavted and 0 for de-activated, | + | | width="90%" | Detector Ident |
− | + | |- | |
− | + | | colspan="2" | An ID value to identify this particular detector. Will be sent as the 'Ident' value for the notification events sent out so that multiple detectors can be told apart. The event value will be 1 for actiavted and 0 for de-activated, | |
− | + | |- | |
− | + | | width="10%" align="center" | [[File:Fc9-type-21-icon.png]] | |
− | + | | width="90%" | Timer Interval (ms) | |
− | Time in milliseconds between testing for proximity. | + | |- |
− | + | | colspan="2" | Time in milliseconds between testing for proximity. Small time = Greater CPU load Large time = More like to miss activation if it is very brief. | |
− | Small time = Greater CPU load | + | |} |
− | |||
− | Large time = More like to miss activation if it is very brief. |
Revision as of 16:24, 7 January 2022
Author | Matrix Ltd |
Version | 1.2 |
Category | Sensors |
Contents
Proximity Switch Template component
Polls a chosen panel object to test it's distance from this component. When the test object is within the detection range, the state of a pin is changed, and a User event generated. Used for building models of reed swicthes and hall sensors.
Component Pack
SENSORS
Detailed description
No detailed description exists yet for this component
Examples
Simple example showing the proximity detector component at work, when a proximity is detected the direction of the motor is reversed.
Detector
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. | |
![]() |
Return |