Difference between revisions of "Component: Motion ( Data)"

From Flowcode Help
Jump to navigationJump to search
(Created page with "{| style="width:50%" |- | width="20%" style="color:gray;" | Author | MatrixTSL |- | width="20%" style="color:gray;" | Version | 1.0 |- | width="20%" style="color:gray;...")
 
 
(One intermediate revision by the same user not shown)
Line 14: Line 14:
 
==Motion component==
 
==Motion component==
 
Component that provides motion data for the mobile device using its internal accelerometer
 
Component that provides motion data for the mobile device using its internal accelerometer
 +
  
 
==Version information==
 
==Version information==
Line 24: Line 25:
 
==Detailed description==
 
==Detailed description==
  
''No detailed description exists yet for this component''
+
Many mobile devices contain an internal accelerometer which can report the acceleration in each of the 3 perpendicular axes - x, y and z.
 +
 
 +
This component allows access to the data provided by this sensor (if available) and can report the data with/without the contribution of the gravity force at that time.
 +
 
  
 
==Examples==
 
==Examples==
  
''<span style="color:red;">No additional examples</span>''
+
===Graphing the accelerometer output===
 +
This example shows the acceleration in the 3 axes on a chart.
 +
 
 +
{{Fcfile|DeviceMotion.fcweb|DeviceMotion.fcweb}}
 +
 
 +
The web app created by this example can be viewed here: [https://www.flowcode.co.uk/example/WebComps/DeviceMotion.html DeviceMotion Example]
 +
 
 +
 
 +
===Using the Motion component with a callback===
 +
The is a similar example to above, but this one uses a callback function to retrieve the acceleration data on a regular basis.
 +
 
 +
{{Fcfile|DeviceMotionWithCallback.fcweb|DeviceMotionWithCallback.fcweb}}
 +
 
 +
The web app created by this example can be viewed here: [https://www.flowcode.co.uk/example/WebComps/DeviceMotionWithCallback.html DeviceMotionWithCallback Example]
 +
 
  
 
==Macro reference==
 
==Macro reference==

Latest revision as of 15:27, 27 April 2026

Author MatrixTSL
Version 1.0
Category Data


Motion component

Component that provides motion data for the mobile device using its internal accelerometer


Version information

Library Version, Component Version, Date, Author, Info
1, 1.0, 24-04-26, ST, Created


Detailed description

Many mobile devices contain an internal accelerometer which can report the acceleration in each of the 3 perpendicular axes - x, y and z.

This component allows access to the data provided by this sensor (if available) and can report the data with/without the contribution of the gravity force at that time.


Examples

Graphing the accelerometer output

This example shows the acceleration in the 3 axes on a chart.

FC6 Icon.png DeviceMotion.fcweb

The web app created by this example can be viewed here: DeviceMotion Example


Using the Motion component with a callback

The is a similar example to above, but this one uses a callback function to retrieve the acceleration data on a regular basis.

FC6 Icon.png DeviceMotionWithCallback.fcweb

The web app created by this example can be viewed here: DeviceMotionWithCallback Example


Macro reference

GetAcceleration

Fc9-comp-macro.png GetAcceleration
Returns the device's acceleration in the specified direction 
Fc9-s32-icon.png - LONG Axis
The axis to use (0=x, 1=y, 2=z) 
Fc9-bool-icon.png - BOOL Compensate
Set true to compensate for the effects of gravity 
Fc9-f32-icon.png - FLOAT Return


GetInterval

Fc9-comp-macro.png GetInterval
Returns the interval at which the data is obtained from the device (in ms) 
Fc9-s32-icon.png - LONG Return


Initialise

Fc9-comp-macro.png Initialise
Begins monitoring of the device's orientation information. Returns true if the device can provide orientation information. 
Fc9-bool-icon.png - BOOL Return


Property reference

Fc9-prop-icon.png Properties
Fc9-type-7-icon.png Use Callback
Set true to use a callback that retrieves regular updates of the device accelerometer 

Component Source Code

Please click here to download the component source project: FC_Comp_Source_WEBEXP_Motion.fcsx

Please click here to view the component source code (Beta): FC_Comp_Source_WEBEXP_Motion.fcsx