dbozgoren Posted October 30, 2014 Report Share Posted October 30, 2014 Hi, How do you just read MPU6050_RA_ACCEL_XOUT_H and get all 6 register values for void MPU6050::getMotion6(.....) ? Thank you in advance. details ------------------------------------------------------------------------------------------ how I would implement getMotion6() (see https://github.com/Snowda/MPU9250/blob/master/MPU9250.cpp) { uint8_t msb = readRegister(MPU9250_ACCEL_XOUT_H); uint8_t lsb = readRegister(MPU9250_ACCEL_XOUT_L); *ax = (((int16_t)msb) << 8) | lsb; msb = readRegister(MPU9250_ACCEL_YOUT_H); lsb = readRegister(MPU9250_ACCEL_YOUT_L); *ay = (((int16_t)msb) << 8) | lsb; //repeat for az gx gy gz . . . } the way he implemented getMotion6() that I couldn't understand. (see https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/MPU6050.cpp) { I2Cdev::readBytes(devAddr, MPU6050_RA_ACCEL_XOUT_H, 14, buffer); *ax = (((int16_t)buffer[0]) << 8) | buffer[1]; *ay = (((int16_t)buffer[2]) << 8) | buffer[3]; *az = (((int16_t)buffer[4]) << 8) | buffer[5]; *gx = (((int16_t)buffer[8]) << 8) | buffer[9]; *gy = (((int16_t)buffer[10]) << 8) | buffer[11]; *gz = (((int16_t)buffer[12]) << 8) | buffer[13]; } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.