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

'long' should be 'unsigned long' for millis value. #18

Open
Koepel opened this issue Jun 25, 2021 · 0 comments
Open

'long' should be 'unsigned long' for millis value. #18

Koepel opened this issue Jun 25, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@Koepel
Copy link

Koepel commented Jun 25, 2021

To avoid the rollover problem, the variable to store a millis value in should be 'unsigned long'.

In "MPU6050_light.h", the preInterval should be unsigned long.
In the example "GetAllData.ino", the timer should be unsigned long.

There are a few minor things:

Could you use spaces instead of tabs ? Both are used and the indents are not the same.
A millis timer is: if (currentMillis - previousMillis >= interval) {. Could you change the > into >= in the example "GetAllData.ino" ?

This is trickery code:

accZ = (!upsideDownMounting - upsideDownMounting) * ((float)rawData[2]) / acc_lsb_to_g - accZoffset;

Please use normal code:

accZ = ((float)rawData[2]) / acc_lsb_to_g - accZoffset;
if (upsideDownMounting)
  accZ = -accZ;
@rfetick rfetick added the enhancement New feature or request label Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants