I'm using the MPU6050 library by Jeff Rowberg. In the code, whole fifobuffer is not passed to the 'teapotPacket' array (for processing ,i.e, graphics emulation). Why only certain indexes are passed in the 'teapotPacket' array ?(to be precise, only indexes given below are passed)
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];
and please clarify one more thing, why the 'teapotPacket' array is initialized with the $ , hex numbers and '\n' & '\r' characters ?
uint8_t teapotPacket[14] = { '$', 0x02, 0,0, 0,0, 0,0, 0,0, 0x00, 0x00, '\r', '\n' };
Duplicate of Question : Why “fifoBuffer” values of indexes 2,3,6,7,10,11 are not passed in the teapotPacket[] array?
Quoting my answer again here for completeness:
In the code, while passing data to the Teapot library(for processing,i.e, graphics emulation), whole fifobuffer is not passed. Why is that so ?
Digging deeper into the library code, I found out that its just a "InvenSense Teapot demo" format for displaying the quaternion values.
Why the teapotPacket[14] array is initialised with these weird hex numbers ?
Its a packet structure format for InvenSense teapot, used for storing the sensor readings like quaternion values.
A little more information about : "Quaternion values" :
Quaternions is a number system that extends the complex numbers used for calculations involving three-dimensional rotations such as in three-dimensional computer graphics, computer vision, and crystallographic texture analysis.