It looks like you're new here. If you want to get involved, click one of these buttons!
require "gyroscope" gyroscope:start() local angx = 0 local angy = 0 local angz = 0 local function onEnterFrame(event) local x, y, z = gyroscope:getRotationRate() angx = angx + x * event.deltaTime angy = angy + y * event.deltaTime angz = angz + z * event.deltaTime print(angz * 180 / math.pi) end stage:addEventListener(Event.ENTER_FRAME, onEnterFrame) |
Comments
I've expanded over this snippet to have a small application to test the hardware: I've put it on Github at:
https://github.com/pmanna/GyroscopeTest
Enjoy!
Thanks!