How to offset accelerometer

I can control the ‘bird’ using the accelerometer and this works my only problem is that it works when my device (phone/tablet) is flat, but this is not idle when you hold it in your hand to play. Is there a way to offset the zero point of the accelerometer to like 30° (degrees) on the y axis ?

[code]
display.setStatusBar (display.HiddenStatusBar);
system.setAccelerometerInterval( 50 );
system.setIdleTimer(false);
local background = display.newImage(“bg.png”)

–> GAME CHARACTER
local bird = display.newImage (“helicopter.png”)
bird.x = 100;
bird.y = 100;
bird:setReferencePoint(display.CenterReferencePoint);

– Speed of Movement with tilt. You can change it ans see the effects.
local tiltSpeed = 30;
local motionx = 0;
local motiony = 0;
local rotation = 0;

local function onTilt(event)
– Its for the new position of the bird
motionx = tiltSpeed * event.xGravity;
motiony = tiltSpeed * event.yGravity;
end

local function moveBird (event)
bird.x = motionx + bird.x;
bird.y = bird.y - motiony;
bird.rotation = rotation;
end

Runtime:addEventListener(“accelerometer”, onTilt)
Runtime:addEventListener(“enterFrame”, moveBird)
[/code] [import]uid: 225288 topic_id: 36054 reply_id: 336054[/import]

fix is :

[code]
local delta = -30/180*math.pi – 30 degrees
local cos_delta, sin_delta = math.cos(delta), math.sin(delta)

local function onTilt(event)
– Its for the new position of the bird
motionx = tiltSpeed * event.xGravity
motiony = tiltSpeed * (cos_delta*event.yGravity + sin_delta*event.zGravity)
end
[/code] [import]uid: 225288 topic_id: 36054 reply_id: 143315[/import]

fix is :

[code]
local delta = -30/180*math.pi – 30 degrees
local cos_delta, sin_delta = math.cos(delta), math.sin(delta)

local function onTilt(event)
– Its for the new position of the bird
motionx = tiltSpeed * event.xGravity
motiony = tiltSpeed * (cos_delta*event.yGravity + sin_delta*event.zGravity)
end
[/code] [import]uid: 225288 topic_id: 36054 reply_id: 143315[/import]

fix is :

[code]
local delta = -30/180*math.pi – 30 degrees
local cos_delta, sin_delta = math.cos(delta), math.sin(delta)

local function onTilt(event)
– Its for the new position of the bird
motionx = tiltSpeed * event.xGravity
motiony = tiltSpeed * (cos_delta*event.yGravity + sin_delta*event.zGravity)
end
[/code] [import]uid: 225288 topic_id: 36054 reply_id: 143315[/import]

fix is :

[code]
local delta = -30/180*math.pi – 30 degrees
local cos_delta, sin_delta = math.cos(delta), math.sin(delta)

local function onTilt(event)
– Its for the new position of the bird
motionx = tiltSpeed * event.xGravity
motiony = tiltSpeed * (cos_delta*event.yGravity + sin_delta*event.zGravity)
end
[/code] [import]uid: 225288 topic_id: 36054 reply_id: 143315[/import]