1

I have used this code to get the G-Force value. But the problem is When I keep my iPhone on table still it show 0.99 value.Can any one tell me the reason? Code is

sx = acceleration.x * kFilteringFactor + sx * (1.0 - kFilteringFactor);
sy = acceleration.y * kFilteringFactor + sy * (1.0 - kFilteringFactor);
sz = acceleration.z * kFilteringFactor + sz * (1.0 - kFilteringFactor);

float aValue = sqrt(sx*sx+sy*sy+sz*sz);

[gLabel setText:[NSString stringWithFormat:@"%.2f",aValue]];
SRI
  • 1,514
  • 21
  • 39

1 Answers1

0

At least in Android that is correct and is because of Gravity. The only way to get 0 would be in a free fall. IF it is on a table then there is a force applied to "not be falling" which is of the same magnitude of the Gravity (1G) and oppose direction.

polonskyg
  • 4,269
  • 9
  • 41
  • 93