Hello,
I have 2 questions concerning Sketch “MPU6050_DMP6.ino” for Arduino and “MPUTeapot.pde” for Processing.
https://github.com/sparkfun/MPU-9150_Breakout
I have read these documents, but I have not figured these out yet:
- What do these values (fifoBuffer[0], [1], [4], [5], [8], [9], [12], [13]) in “MPU6050_DMP6.ino” correspond to the values of FIFO of MPU6150 or MPU9150 (or Gyro-X, Y, Z, Accelometer-X, Y, Z, etc.)?
(from line 337)
#ifdef OUTPUT_TEAPOT
// display quaternion values in InvenSense Teapot demo format:
teapotPacket[2] = fifoBuffer[0];
teapotPacket[3] = fifoBuffer[1];
teapotPacket[4] = fifoBuffer[4];
teapotPacket[5] = fifoBuffer[5];
teapotPacket[6] = fifoBuffer[8];
teapotPacket[7] = fifoBuffer[9];
teapotPacket[8] = fifoBuffer[12];
teapotPacket[9] = fifoBuffer[13];
Serial.write(teapotPacket, 14);
teapotPacket[11]++; // packetCount, loops at 0xFF on purpose
#endif
- What do these lines in “MPUTeapot.pde” actually do (Shifts bits, bitwise OR, and / 16384.0f ???) ?
(from line 169)
// get quaternion from data packet
q[0] = ((teapotPacket[2] << 8) | teapotPacket[3]) / 16384.0f;
q[1] = ((teapotPacket[4] << 8) | teapotPacket[5]) / 16384.0f;
q[2] = ((teapotPacket[6] << 8) | teapotPacket[7]) / 16384.0f;
q[3] = ((teapotPacket[8] << 8) | teapotPacket[9]) / 16384.0f;
for (int i = 0; i < 4; i++) if (q >= 2) q = -4 + q*;*
Thank you in advance.