Storing acceleration values in Objective-C/Cocoa?
Posted
by ASchlaep
on Stack Overflow
See other posts from Stack Overflow
or by ASchlaep
Published on 2010-05-09T20:05:19Z
Indexed on
2010/05/09
20:08 UTC
Read the original article
Hit count: 131
Hi all,
I'm writing for the iPhone and I'm trying to measure the time between maximum accelerations. Imagine you've attached your iPhone to an oscillating spring. What I want to do is measure the frequency of the oscillation. The way I am going about doing this is storing a certain number acceleration values (updated 20 times per second) in an NSMutableArray and comparing the current acceleration value with previous acceleration values.
How do I add each updated acceleration value to the NSMutableArray and at the same time delete values from the back of the array as I don't need them any more?
Thanks in advance!
© Stack Overflow or respective owner