1

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' };
Rohit Lal
  • 2,791
  • 1
  • 20
  • 36
  • Those are just variables. Look somewhere in the source for `#define I2CDEV_IMPLEMENTATION` and `#define I2CDEV_ARDUINO_WIRE` – Ryan Bemrose Jan 30 '17 at 05:19
  • What you are seeing there is just the declaration of variables. Voting to close as the question is too broad. "Please explain all this code to me" is not an adequate question. If you have a particular area of confusion, then it may be appropriate to ask about that. – Andrew Guy Jan 30 '17 at 05:21

1 Answers1

0

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.

Rohit Lal
  • 2,791
  • 1
  • 20
  • 36