Sticky Accelerometer issue

Hey guys,
I have set up a ship with spritesheets, added screen boundaries so the ship wont go off screen and added steering with accelerometer. The thing is, when it’s tested on device the ship sticks to the walls and sort of hang/laggs when I tilt the other direction. I found the accelerometer code somewhere on the forum a while back but it just seems like a basic setup, can someone please help me with the accelerometer code and make it more responsive/accurate even when the player hold the device with an angle or lay down?

Help please…

[code]
system.setAccelerometerInterval( 100 )

local shipGroup = display.newGroup()

local textureAtlas = require (“textureAtlas”)
local textureAtlas = spriteGrabber.grabSheet(“textureAtlas”)
local ship = textureAtlas:grabSprite(“ship”,true);

ship:setReferencePoint(display.CenterReferencePoint);
ship.x = originX;
ship.y = originY;

shipGroup:insert(ship);
localGroup:insert(shipGroup);

local motionX = 0
local motionY = 0

local function onAccelerate( event )

motionX = 10 * event.xGravity;
–motionY = 10 * event.yGravity;
end

Runtime:addEventListener (“accelerometer”, onAccelerate);

local function moveShip (event)
ship.x = ship.x + motionX;
–ship.y = ship.y - motionY;
end

Runtime:addEventListener(“enterFrame”, moveShip)

local function screenBoundaries (event)

– Left side boundaries
if ship.x < 0 + ship.width/2 then
ship.x = 0 + ship.width/2
end

– Right side boundaries
if ship.x > 320 - ship.width/2 then
ship.x = 320 - ship.width/2
end

– Upper boundaries
if ship.y < 0 + ship.height/2 then
ship.y = 0 + ship.height/2
end

– Lower boundaries
if ship.y > 480 - ship.height/2 then
ship.y = 480 - ship.height/2
end
end

Runtime:addEventListener(“enterFrame”, screenBoundaries)

[/code] [import]uid: 34126 topic_id: 10324 reply_id: 310324[/import]

I fixed the stickyness by changing the accelerometer Interval, an update interval of 50 seems so be ideal for games.

Can someone please show how to calibrate the accelerometer depending on how the user is holding the device (what angle the device is held )? [import]uid: 34126 topic_id: 10324 reply_id: 38331[/import]