Difference between revisions of "Component: Proximity Switch Template (Sensors)"

From Flowcode Help
Jump to navigationJump to search
(XML import)
 
 
(14 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
+
{| style="width:50%"
 
 
{| 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 (Release)
+
| 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.
  
==[[File:Component Icon 92b44587_a7a8_444f_abe6_93e5d1669bc6.png|Image]] Proximity Switch Template component==
+
==Component Source Code==
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.
 
  
 +
Please click here to download the component source project: [https://www.flowcode.co.uk/wiki/componentsource/FC_Comp_Source_Proximity_base.fcfx FC_Comp_Source_Proximity_base.fcfx]
  
This component can be used as a base to create ''child'' components
+
Please click here to view the component source code (Beta): [https://www.flowcode.co.uk/FlowchartView/?wfile=componentsource/FC_Comp_Source_Proximity_base.fcfx FC_Comp_Source_Proximity_base.fcfx]
  
[[File:Component Icon 1c8bc72f_4944_4456_af99_9686c237d6b3.png|Image]] The component Reed Switch is inherited from this.
+
==Detailed description==
  
==Examples==
 
''<span style="color:red;">No additional examples</span>''
 
  
  
==Downloadable macro reference==
 
  
===<span style="font-weight: normal;"><u><tt>ReadState</tt></u></span>===
 
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'''
 
  
:[[Variable Types|BYTE]]
 
  
  
===<span style="font-weight: normal;"><u><tt>WaitUntilHigh</tt></u></span>===
 
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
+
''No detailed description exists yet for this component''
  
timer driven objects!!
+
==Examples==
  
'''Parameters'''
 
  
:''This macro has no parameters''
 
  
  
'''Return value'''
 
  
:''This call does not return a value''
 
  
  
===<span style="font-weight: normal;"><u><tt>WaitUntilLow</tt></u></span>===
 
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''
 
  
 +
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}}
  
  
==Simulation macro reference==
 
  
===<span style="font-weight: normal;"><u><tt>SetTarget</tt></u></span>===
 
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'''
 
  
:[[Variable Types|HANDLE]] ''Target''
 
::The object to test for collision with.
 
  
  
'''Return value'''
 
  
:''This call does not return a value''
+
==Macro reference==
  
 +
===ReadState===
 +
{| 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;" | '''ReadState'''
 +
|-
 +
| colspan="2" | Get the current collision state. The 'Polarity' property will affect whether a collision is represented by a high or low state.&nbsp;
 +
|-
 +
|-
 +
| 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''
 +
|}
  
  
 +
===SetTarget===
 +
{| 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!!&nbsp;
 +
|-
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-h32-icon.png]] - HANDLE
 +
| width="90%" | Target
 +
|-
 +
| colspan="2" | The object to test for collision with.&nbsp;
 +
|-
 +
| 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''
 +
|}
  
==Property reference==
 
<span style="font-weight: normal;"><u>Pin</u></span>
 
  
This property is of type ''Single digital pin'' and can be referenced with the variable name ''pin''.
+
===WaitUntilHigh===
 +
{| 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!!&nbsp;
 +
|-
 +
|-
 +
| 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''
 +
|}
  
The chip pin that will receive the switch state.
 
  
<span style="font-weight: normal;"><u>Polarity</u></span>
+
===WaitUntilLow===
 +
{| 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!!&nbsp;
 +
|-
 +
|-
 +
| 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''
 +
|}
  
This property is of type ''Fixed list of ints'' and can be referenced with the variable name ''polarity''.
 
  
Select the state that the switch will take when an object triggers the switch.
+
==Property reference==
  
<span style="font-weight: normal;"><u>Datum Object</u></span>
+
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
+
|-
This property is of type ''Panel object'' and can be referenced with the variable name ''test_object''.
+
| width="10%" align="center" style="background-color:#D8C9D8;" | [[File:Fc9-prop-icon.png]]
 
+
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Properties'''  
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" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Connections
<span style="font-weight: normal;"><u>Range</u></span>
+
|-
 
+
|-
This property is of type ''Floating point'' and can be referenced with the variable name ''range''.
+
| width="10%" align="center" | [[File:Fc9-type-5-icon.png]]
 
+
| width="90%" | Pin
Distance within which the switch is activated.
+
|-
 
+
| colspan="2" | The chip pin that will receive the switch state.&nbsp;
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-16-icon.png]]
<span style="font-weight: normal;"><u>Mouse Object</u></span>
+
| width="90%" | Polarity
 
+
|-
This property is of type ''Panel object'' and can be referenced with the variable name ''mouse_object''.
+
| colspan="2" | Select the state that the switch will take when an object triggers the switch.&nbsp;
 
+
|-
Choose an object within the component  that the user can click on to activate the switch for testing purposes.
+
| width="10%" align="center" style="background-color:#EAE1EA;" | [[File:Fc9-conn-icon.png]]
 
+
| width="90%" style="background-color:#EAE1EA; color:#4B008D;" | Simulation
<span style="font-weight: normal;"><u>Detector Ident</u></span>
+
|-
 
+
|-
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''event_id''.
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
 
+
| width="90%" | Datum Object
An ID value to identify this particular detector.  Will be sent as the 'Ident' value for the notification
+
|-
 
+
| 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.&nbsp;
events sent out so that multiple detectors can be told apart.
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-15-icon.png]]
The event value will be 1 for actiavted and 0 for de-activated,
+
| width="90%" | Range
 
+
|-
<span style="font-weight: normal;"><u>Timer Interval (ms)</u></span>
+
| 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.&nbsp;
 
+
|-
This property is of type ''Unsigned integer'' and can be referenced with the variable name ''timer_int''.
+
| width="10%" align="center" | [[File:Fc9-type-17-icon.png]]
 
+
| width="90%" | Mouse Object
Time in milliseconds between testing for proximity.
+
|-
 
+
| colspan="2" | Choose an object within the component  that the user can click on to activate the switch for testing purposes.&nbsp;
Small time = Greater CPU load
+
|-
 
+
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
Large time = More like to miss activation if it is very brief.
+
| 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,&nbsp;
 +
|-
 +
| width="10%" align="center" | [[File:Fc9-type-21-icon.png]]
 +
| width="90%" | Timer Interval (ms)
 +
|-
 +
| 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.&nbsp;
 +
|}

Latest revision as of 13:12, 7 February 2023

Author Matrix Ltd
Version 1.2
Category 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 Source Code

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

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

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. FC6 Icon.png Detector






Macro reference

ReadState

Fc9-comp-macro.png ReadState
Get the current collision state. The 'Polarity' property will affect whether a collision is represented by a high or low state. 
Fc9-u8-icon.png - BYTE Return


SetTarget

Fc9-comp-macro.png 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!! 
Fc9-h32-icon.png - HANDLE Target
The object to test for collision with. 
Fc9-void-icon.png - VOID Return


WaitUntilHigh

Fc9-comp-macro.png 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!! 
Fc9-void-icon.png - VOID Return


WaitUntilLow

Fc9-comp-macro.png 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!! 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png Connections
Fc9-type-5-icon.png Pin
The chip pin that will receive the switch state. 
Fc9-type-16-icon.png Polarity
Select the state that the switch will take when an object triggers the switch. 
Fc9-conn-icon.png Simulation
Fc9-type-17-icon.png Datum Object
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. 
Fc9-type-15-icon.png 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. 
Fc9-type-17-icon.png Mouse Object
Choose an object within the component that the user can click on to activate the switch for testing purposes. 
Fc9-type-21-icon.png Detector Ident
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, 
Fc9-type-21-icon.png Timer Interval (ms)
Time in milliseconds between testing for proximity. Small time = Greater CPU load Large time = More like to miss activation if it is very brief.