Type Number
Event accelerometer
Revision 2017.3122
Keywords accelerometer, yInstant


Provides the change of acceleration relative to the y-axis of the device's screen in portrait orientation. This value is yGravity minus the previous yGravity reading, which provides the delta acceleration relative to zero.

The intent of this value is to detect if the device was "jerked" in a particular direction.


This value is always relative to the device in portrait orientation, regardless of the current orientation of your application. So, if your application is running in landscape mode, you'll need to compensate by 90 degrees.


local function onAccelerate( event )
    print( event.name, event.xInstant, event.yInstant, event.zInstant )
Runtime:addEventListener( "accelerometer", onAccelerate )