This is an archive. | |
See the new ClickWiki at https://clickwiki.github.io. This version is just an archive for the purposes of migrating content to the new structure. |
Accelerometer object
Author | |
Status | Released |
Release Date | Unknown |
Available for | |
Supported Runtimes | |
License | Free |
Download | |
---|---|
Includes Examples | No |
Includes Help Files | Yes |
Links | Included by default. |
The Accelerometer object allows you to receive information from the accelerometers from your mobile device (Android, iPhone, iPad etc.). Please note that the accelerometer hardware drains the battery of the device, and it is a good practice to turn it on only when necessary. The accelerometers are turned on when an Accelerometer object is present in the frame, at the start of the frame. They are turned off when the frame ends.
When you run an application on the PC with the object, it will return values of zero.
Contents
Conditions
Device orientation changed
This condition is true when the orientation of the device has changed. If this is the case, you can get the new orientation by using the Get current orientation expression of the object.
Expressions
Device orientation
Orientation( "Accelerometer object" )
This expression returns the current orientation of the device. A new orientation can be detected by triggering the "Device orientation changed" condition.
It returns values from 0 to 6:
- Unknown (should not happen unless you shake the device)
- Portrait
- Portrait upside down
- Landscape left
- Landscape right
- Face up
- Face down
Direct values
- X Acceleration
XDirect( "Accelerometer object" )
- Y Acceleration
YDirect( "Accelerometer object" )
- Z Acceleration
ZDirect( "Accelerometer object" )
These expressions return the raw values from the accelerometer. The accelerometers are not precise devices, the value will fluctuate very much, even if you do not touch the device.
Gravity isolated values
- X Acceleration
XGravity( "Accelerometer object" )
- Y Acceleration
YGravity( "Accelerometer object" )
- Z Acceleration
ZGravity( "Accelerometer object" )
These expressions return the values from the accelerometer taking away the gravity factor. The accelerometers are not precise devices, the value will fluctuate very much, even if you do not touch the device.
Instantaneous values
- X Acceleration
XInstant( "Accelerometer object" )
- Y Acceleration
YInstant( "Accelerometer object" )
- Z Acceleration
ZInstant( "Accelerometer object" )
These expressions return the values from the accelerometer from the last evaluation. The accelerometers are not precise devices, the value will fluctuate very much, even if you do not touch the device.