Mpu9250
Revision 1:ca2a40219dc1, committed 2020-02-24
- Comitter:
- takuto003
- Date:
- Mon Feb 24 06:46:33 2020 +0000
- Parent:
- 0:98a0cccbc509
- Commit message:
- cpmmit
Changed in this revision
MPU9250.cpp | Show annotated file Show diff for this revision Revisions of this file |
MPU9250.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/MPU9250.cpp Tue Jul 05 07:09:43 2016 +0000 +++ b/MPU9250.cpp Mon Feb 24 06:46:33 2020 +0000 @@ -223,6 +223,10 @@ // can join the I2C bus and all can be controlled by the Arduino as master writeByte(MPU9250_ADDRESS, INT_PIN_CFG, 0x22); writeByte(MPU9250_ADDRESS, INT_ENABLE, 0x01); // Enable data ready (bit 0) interrupt + writeByte(MPU9250_ADDRESS, PWR_MGMT_1, 0x00); +writeByte(MPU9250_ADDRESS, CONFIG, 0x00); +writeByte(MPU9250_ADDRESS, 0x1B, 0x18); +writeByte(MPU9250_ADDRESS, 0x1C, 0x18); } // Function which accumulates gyro and accelerometer data after device initialization. It calculates the average @@ -256,7 +260,7 @@ writeByte(MPU9250_ADDRESS, CONFIG, 0x01); // Set low-pass filter to 188 Hz writeByte(MPU9250_ADDRESS, SMPLRT_DIV, 0x00); // Set sample rate to 1 kHz writeByte(MPU9250_ADDRESS, GYRO_CONFIG, 0x00); // Set gyro full-scale to 250 degrees per second, maximum sensitivity - writeByte(MPU9250_ADDRESS, ACCEL_CONFIG, 0x00); // Set accelerometer full-scale to 2 g, maximum sensitivity + writeByte(MPU9250_ADDRESS, ACCEL_CONFIG, 0x04); // Set accelerometer full-scale to 2 g, maximum sensitivity uint16_t gyrosensitivity = 131; // = 131 LSB/degrees/sec uint16_t accelsensitivity = 16384; // = 16384 LSB/g
--- a/MPU9250.h Tue Jul 05 07:09:43 2016 +0000 +++ b/MPU9250.h Mon Feb 24 06:46:33 2020 +0000 @@ -163,17 +163,17 @@ // Set initial input parameters enum Ascale { - AFS_2G = 0, + AFS_2G, AFS_4G, AFS_8G, - AFS_16G + AFS_16G=11 }; enum Gscale { - GFS_250DPS = 0, + GFS_250DPS, GFS_500DPS, GFS_1000DPS, - GFS_2000DPS + GFS_2000DPS=11 }; enum Mscale {