What are the accelerator ranges on the iPhone?

I cannot find any documentation on the Internet about this, and what I search on Google gives me a lot of conflicting information ...

+5
source share
3 answers

From iphonedevsdk.com :

The accelerometers used in the first and second-generation iPhone (and I’ll assume that iPod touch) operate in two modes: +/- 2 g and +/- 8 g. (Actually, as you noticed, they speed up reporting beyond the nominal range. Accuracy is not spec'ed outside this range, though.)

Apple +/- 2 . : 0,018 , ( iPhone 0,018168604, AccelerometerGraph). +/- 8 , .

, Apple , , . ( 0,018 . .)

API. A/D, . (The , .) , +/- 2 . .

+5

aGauge , . "" .

+2

, ...

UIAccelerometer *objAccelerometer;
UILabel *lblxmin, *lblxmax, *lblymin, *lblymax, *lblzmin, *lblzmax;
UILabel *lblxnow, *lblynow, *lblznow;

float xmin = 0.0, xmax = 0.0, ymin = 0.0, ymax = 0.0, zmin = 0.0, zmax = 0.0, xnow = 0.0, ynow = 0.0, znow = 0.0;

- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {   
    //NSLog (@"%f, %f, %f", acceleration.x, acceleration.y, acceleration.z);
    xnow = acceleration.x;
    ynow = acceleration.y;
    znow = acceleration.z;
    if (xnow < xmin) { xmin = xnow; }
    if (ynow < ymin) { ymin = ynow; }
    if (znow < zmin) { zmin = znow; }

    if (xnow > xmax) { xmax = xnow; }
    if (ynow > ymax) { ymax = ynow; }
    if (znow > zmax) { zmax = znow; }

    lblxmin.text = [NSString stringWithFormat:@"%f", xmin];
    lblymin.text = [NSString stringWithFormat:@"%f", ymin];
    lblzmin.text = [NSString stringWithFormat:@"%f", zmin];

    lblxmax.text = [NSString stringWithFormat:@"%f", xmax];
    lblymax.text = [NSString stringWithFormat:@"%f", ymax];
    lblzmax.text = [NSString stringWithFormat:@"%f", zmax];

    lblxnow.text = [NSString stringWithFormat:@"%f", xnow];
    lblynow.text = [NSString stringWithFormat:@"%f", ynow];
    lblznow.text = [NSString stringWithFormat:@"%f", znow];

}

-(void) invokeAccelerometer {   
    objAccelerometer = [UIAccelerometer sharedAccelerometer];
    objAccelerometer.delegate = self;
    objAccelerometer.updateInterval = (1.0 / 10.0);
}

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
    lblxmin = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 100, 40)];
    lblxnow = [[UILabel alloc] initWithFrame:CGRectMake(100, 10, 100, 40)];
    lblxmax = [[UILabel alloc] initWithFrame:CGRectMake(200, 10, 100, 40)];

    lblymin = [[UILabel alloc] initWithFrame:CGRectMake(10, 60, 100, 40)];
    lblynow = [[UILabel alloc] initWithFrame:CGRectMake(100, 60, 100, 40)];
    lblymax = [[UILabel alloc] initWithFrame:CGRectMake(200, 60, 100, 40)];

    lblzmin = [[UILabel alloc] initWithFrame:CGRectMake(10, 110, 100, 40)];
    lblznow = [[UILabel alloc] initWithFrame:CGRectMake(100, 110, 100, 40)];
    lblzmax = [[UILabel alloc] initWithFrame:CGRectMake(200, 110, 100, 40)];

    [self.view addSubview:lblxmin];
    [self.view addSubview:lblxnow];
    [self.view addSubview:lblxmax];

    [self.view addSubview:lblymin];
    [self.view addSubview:lblynow];
    [self.view addSubview:lblymax];

    [self.view addSubview:lblzmin];
    [self.view addSubview:lblznow];
    [self.view addSubview:lblzmax];

    [self invokeAccelerometer];

    [super viewDidLoad];
}

, iPod / , , , :

xmin -1.271802

xmax 1.180959

ymin -1.344477

ymax 1.108285

zmin -2.30713

zmax 2.325581

iPod , ...

x -2.325581 2.307413

y -2.325581 2.307413

z -2.307413 2.325581

, ?

, , :

x = -1, (< |)

x = +1, (| > )

  • < , | iPod

y ~ -1, , ( "" )

y ~ 1, ( )

+1

All Articles