I am using the device accelerometer and try to smooth the Accelerometer Data CMAcceleration
.
I am doing this with help of this code:
-(void)proccessAccelerometerData:(CMAcceleration)accelData {
currentAccelX = (kUpdateInterval * accelData.x) + ((1.0 - kUpdateInterval) * currentAccelX);
currentAccelY = (kUpdateInterval * accelData.y) + ((1.0 - kUpdateInterval) * currentAccelY);
}
Which currentAccelX
and currentAccelY
is the last accelerometer x and y data.
Now, I have the smooth x and y values, What is my value of x or y to determine id the user move the device left/right/up/down?
Just to make things more clear, for example, let's say that I have 4 buttons, one for each direction left/right/up/down and I want to determine which direction the user user swipe the device? (not swipe gesture). Thanks in advance!