Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 19 additions & 3 deletions docs/dictionary/message/accelerationChanged.lcdoc
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,31 @@ Handle the <accelerationChanged> message if you want to perform an
action when the acceleration along any axis changes

The <accelerationChanged> message is sent to the current card of the
defaultStack at the interval specified by the mobileEnableAccelerometer
command.
defaultStack at the interval specified by the
<mobileEnableAccelerometer> command.

You can use the difference between the time values in two
<accelerationChanged> events to give an indication of how much time
passed between the samples.

>*Note:* On Android, the change in acceleration output is in meters
> per second squared whereas on iOS, it is in G-forces. In order to
> normalize these changes in acceleration, you must detect the
> <platform> and convert appropriately. For example:

on accelerationChanged pXAccel, pYAccel, pZAccel
if the platform is "iphone" then
-- Convert from g-forces to m/s^2
multiply pXAccel by 9.81
multiply pYAccel by 9.81
multiply pZAccel by 9.81
end if
-- the rest of your code
end accelerationChanged

References: mobileStopTrackingSensor (command),
mobileStartTrackingSensor (command)
mobileStartTrackingSensor (command),
mobileEnableAccelerometer (command), platform (function)

Tags: ui

1 change: 1 addition & 0 deletions docs/notes/bugfix-21111.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Explained mobile accelerometer differences in the accelerationChanged entry