Gravity problem

This is my project, I need help for Gravity because I want that it change when I rotate my own device.

local mondoFisico=require “physics”

mondoFisico.start()

local gravityValue=50

mondoFisico.setGravity(0,gravityValue)

–mondoFisico.setDrawMode(“debug”)

local deviceWidth = display.contentWidth–larghezza in pixel del telefono

local deviceHeight = display.contentHeight–larghezza in pixel del telefono

local sfondo= display.newImageRect(“images/sfondo.jpg”,deviceWidth,deviceHeight)

sfondo.x=deviceWidth/2

sfondo.y=deviceHeight/2

local myBalls= {}

local floor=display.newRect(deviceWidth/2,deviceHeight,deviceWidth,20)

floor.y=floor.y-floor.contentHeight/2

local ceiling= display.newRect(deviceWidth/2,0,deviceWidth,20)

ceiling.y=ceiling.y+ceiling.contentHeight/2

local leftWall= display.newRect(0,deviceHeight/2,20,deviceHeight)

leftWall.x=leftWall.x+leftWall.contentWidth/2

local rightWall = display.newRect(deviceWidth,deviceHeight/2,20,deviceHeight)

rightWall.x=rightWall.x-rightWall.contentWidth/2

local rect1= display.newRect(deviceWidth/2-deviceWidth/11,deviceHeight/4,deviceWidth-deviceWidth/3.5,10)

local rect2= display.newRect(deviceWidth/2+deviceWidth/6,deviceHeight/2,deviceWidth-deviceWidth/2.3,10)

local rect3= display.newRect(0,0,10,deviceHeight/8)

rect3.x= deviceWidth/2-rect3.contentWidth*3.7

rect3.y= deviceHeight/2-rect3.contentHeight/2-rect2.contentHeight/2

local rect4= display.newRect(deviceWidth/2-deviceWidth/3.85,deviceHeight/2+deviceHeight/8,deviceWidth/2-deviceWidth/8,10)

local rect5= display.newRect(deviceWidth/2,deviceHeight/2+deviceHeight/6,deviceWidth/3,10)

mondoFisico.addBody(floor,“static”,{friction=1})

mondoFisico.addBody(ceiling,“static”,{friction=1})

mondoFisico.addBody(leftWall,“static”,{friction=1})

mondoFisico.addBody(rightWall,“static”,{friction=1})

mondoFisico.addBody(rect1,“static”,{friction=0})

mondoFisico.addBody(rect2,“static”,{friction=1})

mondoFisico.addBody(rect3,“static”,{friction=1})

mondoFisico.addBody(rect4,“static”,{friction=1})

mondoFisico.addBody(rect5,“static”,{friction=1})

 function onAccelerate(event)

     mondoFisico.setGravity(event.xGravity*gravityValue,event.yGravity*gravityValue)

    for index=1, 1 do

     myBalls[index]:setLinearVelocity(event.xGravity,event.yGravity)

    end

end

for index=1, 1 do

  myBalls[index]= display.newImage(“images/palla”…tostring(index)…".png")

  mondoFisico.addBody(myBalls[index],{friction=0.6,bounce=0.7,radius=myBalls[index].contentWidth/2})

  myBalls[index].x=leftWall.contentWidth+index*myBalls[index].contentWidth/2

  myBalls[index].y=ceiling.contentHeight+index*myBalls[index].contentHeight

end

Runtime:addEventListener(“accelerometer”, onAccelerate

–Thanks–