Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recommended frequency to call hub.handle() #13

Open
ululi1970 opened this issue Apr 27, 2021 · 1 comment
Open

Recommended frequency to call hub.handle() #13

ululi1970 opened this issue Apr 27, 2021 · 1 comment

Comments

@ululi1970
Copy link

ululi1970 commented Apr 27, 2021

Is there a recommended frequency to call hub.handle()?

That is, in

`
#include <Sport.h>
SportHub hub(SENSOR_ID, PIN);
#define INTERVAL = XXX
//...
unsigned long previous = 0;

void setup()
{//...
previous = millis();
//...

}

void loop(){
// calculate new values for sensor values

if (millis()-previous > INTERVAL) {
hub.handle();
previous = millis();
//...
}
`

what would be the minimum value for INTERVAL?

@RealTadango
Copy link
Owner

The hub.handle(); should be called very often, about 1000Hz. Calling it every loop run would be best. The method is very light and does not use much cpu time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants