// fs_sel = 1
// 500°/s
-#define gyro_x_resolution 66.5
-#define gyro_y_resolution 66.5
-#define gyro_z_resolution 66.5
+/* #define gyro_x_resolution 66.5 */
+/* #define gyro_y_resolution 66.5 */
+/* #define gyro_z_resolution 66.5 */
// fs_sel = 3
// 2000°/s
#define gyro_y_resolution 16.4
#define gyro_z_resolution 16.4
-#define accel_x_resolution 8192.0
-#define accel_y_resolution 8192.0
-#define accel_z_resolution 8192.0
+#define accel_x_resolution 2048.0
+#define accel_y_resolution 2048.0
+#define accel_z_resolution 2048.0
#define MPU6050_OFF_LSB 0
-#define MPU6050_ADDRESS 0x68
-#define MPU6050_MAGNETO_ADDRESS 0x0C
+#define MPU6050_ADDRESS 0x69
+#define MPU6050_MAGNETO_ADDRESS 0x0D
#define SWAP_16(a) ((( (a) & 0xff)<<8) | (( (a) >> 8) & 0xff))
while(1) {
- err = read_reg(MPU6050_ADDRESS, 0x75, &id);
+ err = read_reg(MPU6050_ADDRESS, MPU6050_RA_WHO_AM_I, &id);
if (err)
continue;
if (id == 0x68)
//Disable gyro self tests, scale of 2000 degrees/s
send_mpu6050_cmd(MPU6050_ADDRESS, MPU6050_RA_GYRO_CONFIG, 0b00011000);
+ //Disable accel self tests, scale of +-16g, no DHPF
+ send_mpu6050_cmd(MPU6050_ADDRESS, MPU6050_RA_ACCEL_CONFIG, 0b00011000);
- //Disable accel self tests, scale of +-4g, no DHPF
- send_mpu6050_cmd(MPU6050_ADDRESS, MPU6050_RA_ACCEL_CONFIG, 0b00001000);
//Freefall threshold of <|0mg|
send_mpu6050_cmd(MPU6050_ADDRESS, MPU6050_RA_FF_THR, 0x00);
//Freefall duration limit of 0