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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:24:28+00:00 2026-06-18T08:24:28+00:00

My problem is find a way to reduce the number of updateAccelerometer calls. int

  • 0

My problem is find a way to reduce the number of updateAccelerometer calls.

int count = 0;
int accelerometer = updateAccelerometer();
while (accelerometer <= 500) {
  printf("Actual: %lf", accelerometer);
  accelerometer = updateAccelerometer();
  count++;
}

Which gives:

Actual: 9
Actual: 28
Actual: 47
Actual: 65
Actual: 84
Actual: 103
Actual: 122
Actual: 141
Actual: 159
Actual: 178
Actual: 197
Actual: 216
Actual: 235
Actual: 253
Actual: 272
Actual: 291
Actual: 310
Actual: 329
Actual: 347
Actual: 366
Actual: 385
Actual: 404
Actual: 423
Actual: 442
Actual: 460
Actual: 479
Actual: 498

Now my problem is that I dont want to update the accelerometer every time, but in an exponential proportional ratio, for example. If I introduce a “linear proportional ratio”

I will just do:

if (count % 2 = 0) accelerometer = updateAccelerometer();

Which means, one value will be read, one value will not be, etc etc etc, since everytime I call updateAccelerometer it might take time, I would like to take less values when I am far away and more value when I am closer.

So the idea is to have an exponential function that will return me only the ones marked with x, not because I dont print the others, but because I dont update the accelerometer

Actual: 9
Actual: 28
Actual: 47
Actual: 65
Actual: 84
Actual: 103x
Actual: 122
Actual: 141
Actual: 159
Actual: 178
Actual: 197
Actual: 216
Actual: 235x
Actual: 253
Actual: 272
Actual: 291
Actual: 310
Actual: 329x
Actual: 347
Actual: 366
Actual: 385
Actual: 404x
Actual: 423
Actual: 442
Actual: 460x
Actual: 479
Actual: 498x

This is not a very specific problem, since I had this problem of exponentially skipping updates in many other situation, any tick?

  • 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-18T08:24:29+00:00Added an answer on June 18, 2026 at 8:24 am

    It looks like the number of counts until you next sample the accelerator should be about sqrt(fabs(500 - accelerometer)) / 3.25.

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

Sidebar

Related Questions

i'm trying to find a way to match this problem but i'm LOST i
I can't seem to find a way to fix this problem. All I'm doing
I faced a problem that I can not find a way to change the
The problem seems simple, but I can't seem to find a way to implement
After searching, I dont find the appropriate way to resolve following problem. After activating
Earlier today I asked similar problem to find the maximum element which is common
I have a problem to find the right way to program dynamic fields. For
Problem statement: Find the right triangle that has integers for all sides and all
i have this problem to find a particular xml node l have post this
My problem is to find best view configuration for my application that have a

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.