MPU6050_light
MPU6050_light copied to clipboard
'long' should be 'unsigned long' for millis value.
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;