i am gathering accelerometer and gyroscope data using push methods( startDeviceMotionUpdatesToQueue:withHandler: and startGyroUpdatesToQueue:[NSOperationQueue mainQueue] I compare these raw data with certain thresholds, if it satisfies the threshold, I do increase a label counter by one , my problem is when I start detecting ie reading the methods and comparing it to thresholds , the counter increases so fast, I have read in (Simple iPhone motion detect) that " if condition will become true twice for every single motion" , so if this is what is happening with me, how do i solve the problem, my code is simple
checkData{
if ( ( acc_2 >= 0.03885) && (gyro_3 >= 0.0003) && (gyro_3 <= 0.00838))
{
i=i+1;
//then Label data
_Counter.text=[NSString stringWithFormat:@"%d",i];
}
else if (( acc_2>= 0.01103) && ( gyro_3 >= 0.00851))
{
/
//update the counter
i=i+1;
_Counter.text=[NSString stringWithFormat:@"%d",i];
}
...... same other conditions
}
then I do call this method inside startDeviceMotionUpdatesToQueue:withHandler: block.
[ self checkData];
what can i do to fix the problem, can you guide me ? }