jrowberg / i2cdevlib

I2C device library collection for AVR/Arduino or other C++-based MCUs
http://www.i2cdevlib.com
3.92k stars 7.52k forks source link

Using float for mpu.getMotion6 #405

Open amadeok opened 6 years ago

amadeok commented 6 years ago

Hi, When using float variables inside mpu.getMotion6() i get this error

`C:\Users\Amadeo\Documents\Arduino\Mouse_Gyro_ENG_working_compl\Mouse_Gyro_ENG_working_compl.ino: In function 'void loop()':

Mouse_Gyro_ENG_working_compl:54: error: no matching function for call to 'MPU6050::getMotion6(float, float, float, float, float, float)'

mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);

`

I understand this could be fixed by using double, however i'd like to use float. Is this possible?

dsyleixa commented 6 years ago

what about explicitely casting to double for passing to the function?

mpu.getMotion6(&(double)ax, &(double)ay, &(double)az, &(double)gx, &(double)gy, &(double)gz);

BTW, I would agree to generally use float instead of double in the Arduino lib section, as suggested by me here: https://github.com/jrowberg/i2cdevlib/issues/407