Difference between revisions of "Accelerometer.isAvailable"
From GiderosMobile
(Created page with "The Accelerometer class is used to access accelerometer data. <syntaxhighlight lang=lua style="border:3px"> --create instance local accelerometer = Accelerometer.new() --star...") |
|||
Line 12: | Line 12: | ||
--once you don't need it, stop it | --once you don't need it, stop it | ||
accelerometer:stop() | accelerometer:stop() | ||
+ | </syntaxhighlight> |
Revision as of 23:59, 21 August 2018
The Accelerometer class is used to access accelerometer data.
--create instance
local accelerometer = Accelerometer.new()
--start receiving data
accelerometer:start()
---get values for example on each enter frame event
local x, y, z = accelerometer:getAcceleration()
print(x, y, z)
--once you don't need it, stop it
accelerometer:stop()