title: Accelerometer to cm - Xcode
body: <p><img src="https://i.stack.imgur.com/sJjwZ.jpg" alt="enter image description here"></p>
  
  <p>I have this result for my accelerometer , I would like to convert this to cm. what conversion would I have to do?</p>
  
  <p>(.h)</p>
  
  <pre><code>#import &lt;UIKit/UIKit.h&gt;
  
  @interface ViewController : UIViewController&lt;UIAccelerometerDelegate&gt;
  {
      IBOutlet UILabel *xlabel;
      IBOutlet UILabel *ylabel;
      IBOutlet UILabel *zlabel;
  
  }
  @end
  </code></pre>
  
  <p>(.m)</p>
  
  <pre><code>#import "ViewController.h"
  
  @interface ViewController ()
  
  @end
  
  @implementation ViewController
  
  - (void)viewDidLoad
  {
      [super viewDidLoad];
      [[UIAccelerometer sharedAccelerometer]setDelegate:self];
      //Do any additional setup after loading the view,typically from a nib
  }
  
  - (void)didReceiveMemoryWarning
  {
      [super didReceiveMemoryWarning];
      // Dispose of any resources that can be recreated.
  }
  - (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:
    (UIAcceleration *)acceleration{
      [xlabel setText:[NSString stringWithFormat:@"%f",acceleration.x]];
      [ylabel setText:[NSString stringWithFormat:@"%f",acceleration.y]];
      [zlabel setText:[NSString stringWithFormat:@"%f",acceleration.z]];
  }
  
  @end
  </code></pre>
  
  <p>Is it possible to find the distance by using accelerometer?</p>
  
  <p>Thanks for answers, thanks for people who took the time to help.</p>