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

Trouble using 2 mpu #31

Open
JSlain opened this issue Jun 27, 2022 · 1 comment
Open

Trouble using 2 mpu #31

JSlain opened this issue Jun 27, 2022 · 1 comment

Comments

@JSlain
Copy link

JSlain commented Jun 27, 2022

I struggle to make the library working with 2 modules.
At the startup of my application, sometime it's working, sometime not, or it's simply hanging.

Then i realized it seems that in the begin() function, the first time we call the update() function, preInterval = 0, and it's compared to millis() to calculate the value of dt.
Depending on the order of the things you initialize in your application setup() function, the first time the millis() function will be called might give you a pretty big number, which will then enter loops in the wrap() function.
The second module will be even greater, since it waits for the first ont to complete.

I noticed you initialize that variable after the update(), which is kinda weird since it's already set in the update() method itself.

  this->update();
  angleX = this->getAccAngleX();
  angleY = this->getAccAngleY();
  preInterval = millis(); // may cause lack of angular accuracy if begin() is much before the first update()
  return status;

Would it be okay to initialize the variable before update() instead of after?
I'm not quite sure what it is for, but i know it's what slows me down.

@Gugarauj07
Copy link

Hey, Im trying to use the setAddress() Method but im still only having the data from the 0x68 device. Can somebody help me?

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