Question

Is there a function or method to get the iphone's current sampling rate of the running accelerometer?

I know how to set the iPhone accelerometer to a certain frequency, but I would like to verify that it is actually running at that frequency

It should look like this to set the accelerometer to running...

// Set the Accelerometer to 30 updates per second
filter = [[filterClass alloc] initWithSampleRate:30.0 cutoffFrequency:5.0];
filter.adaptive = useAdaptive;
[[UIAccelerometer sharedAccelerometer] setUpdateInterval:1.0 / 30.0];
[[UIAccelerometer sharedAccelerometer] setDelegate:self];

Now how can we find out what the sample frequency is currently?

Was it helpful?

Solution

oops.... found it..!

NSLog(@"updateInterval: %f", [[UIAccelerometer sharedAccelerometer] updateInterval]);

updateInterval: 0.033333 Bang on 30 cycles per second as set!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top