MPU6050 library that is kinda beta and will probably never leave beta but it might help some people.adreess change 0x68
Revision 3:124fe33a2a38, committed 2018-11-23
- Comitter:
- Nicolas_11
- Date:
- Fri Nov 23 13:21:21 2018 +0000
- Parent:
- 2:5c63e20c50f3
- Commit message:
- Tetris con acelerometro;
Changed in this revision
MPU6050.cpp | Show annotated file Show diff for this revision Revisions of this file |
MPU6050.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 5c63e20c50f3 -r 124fe33a2a38 MPU6050.cpp --- a/MPU6050.cpp Mon Sep 10 21:26:25 2012 +0000 +++ b/MPU6050.cpp Fri Nov 23 13:21:21 2018 +0000 @@ -109,7 +109,7 @@ return (int)retval; } -void MPU6050::getAcceleroRaw( int *data ) { +void MPU6050::getAcceleroRaw( float *data ) { char temp[6]; this->read(MPU6050_ACCEL_XOUT_H_REG, temp, 6); data[0] = (int)(short)((temp[0]<<8) + temp[1]); @@ -118,7 +118,7 @@ } void MPU6050::getAccelero( float *data ) { - int temp[3]; + float temp[3]; this->getAcceleroRaw(temp); if (currentAcceleroRange == MPU6050_ACCELERO_RANGE_2G) { data[0]=(float)temp[0] / 16384.0 * 9.81;
diff -r 5c63e20c50f3 -r 124fe33a2a38 MPU6050.h --- a/MPU6050.h Mon Sep 10 21:26:25 2012 +0000 +++ b/MPU6050.h Fri Nov 23 13:21:21 2018 +0000 @@ -16,7 +16,7 @@ * Defines */ #ifndef MPU6050_ADDRESS - #define MPU6050_ADDRESS 0x69 // address pin low (GND), default for InvenSense evaluation board + #define MPU6050_ADDRESS 0x68 // address pin low (GND), default for InvenSense evaluation board #endif #ifdef MPU6050_ES @@ -153,7 +153,7 @@ * * @param data - pointer to signed integer array with length three: data[0] = X, data[1] = Y, data[2] = Z */ - void getAcceleroRaw( int *data ); + void getAcceleroRaw( float *data ); /** * Reads all accelero data, gives the acceleration in m/s2