Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i am writing a phone's program .use phone to control raciecar on computer,i want to use accelerator to get ,x,y,z ,i can use them to control my keyboard up,down left and right key.
Posted

1 solution

Your question is unclear, but let me try to make attempt of understanding it.

If I am not misunderstood your Question, You are working on Windows Phone 7/7.5 Application. And you want to get "Accelerometer Input" (X,Y,Z) positions.

Use AccelerometerReadingChanged Event. Try as below code.
C#
public void AccelerometerReadingChanged(object sender, AccelerometerReadingEventArgs e)
{
   float xPosition = (float)e.X;
   float yPosition = (float)e.Y;
   float zPosition = (float)e.Z;
}

Have a look at below links for more details.
http://msdn.microsoft.com/en-us/library/ff604984.aspx

http://windowsteamblog.com/windows_phone/b/wpdev/archive/2010/09/08/using-the-accelerometer-on-windows-phone-7.aspx
 
Share this answer
 
Comments
reseweks 24-Oct-11 10:35am    
Thks RaisKazi,
I want to write a phone handShank, use my phone to control computer game .I want to use the Accelerometer to control the racingcar

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900