Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8321067
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:53:23+00:00 2026-06-08T22:53:23+00:00

-(void) play { CMMotionManager *motionManager = [[CMMotionManager alloc] init]; [motionManager startDeviceMotionUpdates]; BOOL timeReached =

  • 0
-(void) play
{
    CMMotionManager *motionManager = [[CMMotionManager alloc] init];
    [motionManager startDeviceMotionUpdates];

    BOOL timeReached = NO;

    while(!self.stopButtonPressed)
    {
        if(motionManager.deviceMotion.userAcceleration.y >= ... && motionManager.deviceMotion.userAcceleration.y <= ...)
        {
             //start timer
        }
        while(motionManager.deviceMotion.userAcceleration.y >= ... && motionManager.deviceMotion.userAcceleration.y <= ... && !timeReached)
        {
            if(//check timer & if timer is >=300ms)
            {
              timeReached = YES;
              NSLog(@"acceleration on Y-axis stayed between ... & .. for at least 300ms");
            }
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T22:53:25+00:00Added an answer on June 8, 2026 at 10:53 pm

    It seems like you’re going about this the wrong way; instead of running a clock, you should be setting accelerometerUpdateInterval to whatever you’re looking for and using startAccelerometerUpdatesToQueue:withHandler: to receive the data.

    From the Apple documentation:

    Handing Motion Updates at Specified Intervals

    To receive motion data
    at specific intervals, the application calls a “start” method that
    takes an operation queue (instance of NSOperationQueue) and a block
    handler of a specific type for processing those updates. The motion
    data is passed into the block handler. The frequency of updates is
    determined by the value of an “interval” property.

    Accelerometer. Set the accelerometerUpdateInterval property to specify
    an update interval. Call the
    startAccelerometerUpdatesToQueue:withHandler: method, passing in a
    block of type CMAccelerometerHandler. Accelerometer data is passed
    into the block as CMAccelerometerData objects.

    Once you’ve set everything up, let it run. When you’ve received a completion notice from the block look at the data you’ve received.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

- (void)fadeOutSplash { UIImageView *splash = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@Default-Landscape~ipad.png]]; [self.window.rootViewController.view addSubview:splash]; // <--
I have this function: public static void Play(string FileName, bool Async = false) {
- (void)TargetHit:(int)target{ void (^threadBlock)(void) = ^{ NSLog(@respond to selector %d, [self respondsToSelector:@selector(changeImageOfTarget:)]); [[NSOperationQueue mainQueue]
- (void)connectionDidFinishLoading:(NSURLConnection *)connection { self.listFeedConnection = nil; // release our connection [UIApplication sharedApplication].networkActivityIndicatorVisible =
void AFCQueue::ExtractValuesSecComplex(int startIndex, int endIndex,int helperIndex) { int size = 0,i,index; TimeType min_timestamp; bool
Using: private void play() { VideoView v = (VideoView) findViewById(R.id.videoView); MediaPlayer mp = MediaPlayer.create(this,
From the Finch audio library: - (void) play { [[sounds objectAtIndex:current] play]; current =
Game.m #import Game.h #import CoreMotion.h @implementation Game - (id) init { self = [super
- (void)viewDidLoad{ [super viewDidLoad]; NSString *path = [[NSBundle mainBundle] pathForResource:@VidName ofType:@mov]; NSURL *url =
void test() { unsigned char c; c = (~0)>>1 ; printf(c is %u\n,c); }

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.