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 8201789
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T06:55:58+00:00 2026-06-07T06:55:58+00:00

I’m writing an iPhone app that is using two uisliders to control values that

  • 0

I’m writing an iPhone app that is using two uisliders to control values that are sent using coreBluetooth. If I move the sliders quickly one value freezes at the receiver, presumably because the Value Changed events trigger so often that the write-commands stack up and eventually get thrown away. How can I make sure the events don’t trigger too often?

Edit:

Here is a clarification of the problem; the bluetooth connection sends commands every 105ms. If the user generates a bunch of events during that time they seem to que up. I would like to throw away any values generated between the connection events and just send one every 105ms.

This is basically what I’m doing right now:

-(IBAction) sliderChanged:(UISlider *)sender{

  static int8_t value = 0;
  int8_t new_value = (int8_t)sender.value;

  if ( new_value > value + threshold || new_value < value - threshold ) {
    value = new_value;  
    [btDevice writeValue:value];
  }
}

What I’m asking is how to implement something like

-(IBAction) sliderChanged:(UISlider *)sender{

  static int8_t value = 0;

  if (105msHasPassed) {
    int8_t new_value = (int8_t)sender.value;

    if ( new_value > value + threshold || new_value < value - threshold ) {
      value = new_value;  
      [btDevice writeValue:value];
    }
  }
}
  • 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-07T06:56:01+00:00Added an answer on June 7, 2026 at 6:56 am

    I guess that it does make sense to still triggered them… What I would do in your case, would be to check the delta between the current value and the previous value. For instance:

    • Current value -> 5.
    • Next value -> 6.
    • Delta 1

    Just a bit of pseudo-code:

    if(delta>5){
     //do your stuff
    }
    

    I wouldn’t probably do this but:

    -(void)sliderValueChanged:(UISlider *)sender{
        [self performSelector:@selector(removeAction:) withObject:sender afterDelay:0.3];
        // Do your stuff
    }
    
    - (void)removeAction:(UISlider *)sender{
        [sender removeTarget:self action:@selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged];    
    
        [self performSelector:@selector(addAction:) withObject:sender afterDelay:0.3];
    }
    
    - (void)addAction:(UISlider *)sender{
        [mySlider addTarget:self action:@selector(sliderValueChanged:) forControlEvents:UIControlEventValueChanged];   
    }
    

    I didn’t tested this, but I think you get the idea.

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

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I am writing an app with both english and french support. The app requests
I am using Paperclip to handle profile photo uploads in my app. They upload
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into

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.