Reputation: 73
hai,In my application i want to calculate the spped based on x,y,z values.So How to find the speed using x,y,z axis values ?
Upvotes: 3
Views: 9690
Reputation: 7
keep update interval of accelerometer to 1 i.e.
accelerometer.updateInteval=1f;
then in the following delegate method
-(void)accelerometer:(UIAccelerometer *) acc didAccelerate:(UIAcceleration *)acceleration {
}
get the acceleration value by acceleration.x
You will have to store the previous value in some variable
difference between the previous value and current value will give you the speed along x axes
Upvotes: -2
Reputation: 38382
Integrate the acceleration of each axis then add together the velocity vectors, and finally take the magnitude. You now have speed.
Upvotes: 3