Accelerometer detecting side to side movement

Can someone please give me an example of how you detect if the iphone is moving to the left or moving to the right. as a long version of the shake, I want my application to be able to find out if the user's hand is going right or left. imagine your hand as a wiper with a phone at the end

any ideas?

Thanks Sam: P

+4
source share
1 answer

This will be the value of acceleration.x. Imagine 3 lines going through your iPhone:
1) the line perpendicular to the screen of your iPhone and passing through it, it will be Z.
2) horizontal and parallel line on the screen, it will be X (what you are looking for).
3) vertical and parallel line on your screen, it will be Y.

Thus, moving the iPhone left or right will lead to changes in the X column. Moving the iPhone up or down will lead to changes in the Y schedule. Moving your iPhone forward or backward will cause changes to the Z chart.
Hope this helps you understand the concept of the accelerometer,
~ Nathanavra.

+5
source

All Articles