Reude,
I am trying to capture acceloremeter events to see what it does, but I don’t get any value. Here is my code:
local updateScreen = function (event)
– Get x,y,z gravity and instant
local xG = event.xGravity
local yG = event.yGravity
local zG = event.zGravity
local xI = event.xInstant
local yI = event.yInstant
local zI = event.zInstant
local v_xG = string.format(’%.0f’, xG)
local v_yG = string.format(’%.0f’, yG)
local v_zG = string.format(’%.0f’, zG)
local v_xI = string.format(’%.0f’, xI)
local v_yI = string.format(’%.0f’, yI)
local v_zI = string.format(’%.0f’, zI)
– update texts
xx= “X=”… v_xG … " G" … v_xI " I"
yy= “Y=”… v_yG … " G" … v_yI " I"
zz= “Z=”… v_zG … " G" … v_zI " I"
tt.text=xx,yy,zz – where tt is display.newText.
end
Runtime:addEventListener( “accelerometer”, updateScreen)
The thing is when I run this app on device, tt always return 0, even if I directly use tt.text=string.format(’%d’,event.xGravity). So I don’t see any accelerometer response on device.
Finally I was trying to setup system.setAccelerometerInterval(50) and no matter what I put as value, like 10, .01 or 10Hz it always get an error, saying value must be a range between [10,100].
So if you already are getting some response of accelerometer on your test, could you point me where I wrong?
Regards,
Flavio. [import]uid: 3022 topic_id: 498 reply_id: 1027[/import]