Skip to content

Instantly share code, notes, and snippets.

@peteroid
Last active October 27, 2016 04:20
Show Gist options
  • Save peteroid/b49030a3a806b159b923aad01442b260 to your computer and use it in GitHub Desktop.
Save peteroid/b49030a3a806b159b923aad01442b260 to your computer and use it in GitHub Desktop.
Arduino side of this
...
// modify the initiator of the packet
uint8_t teapotPacket[20] = { '$', 0x02,
0,0, 0,0, 0,0, 0,0,
0,0, 0,0, 0,0,
0x00, 0x00, '\r', '\n' };
...
loop() {
...
// modify this inside loop function
#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];
teapotPacket[10] = fifoBuffer[28];
teapotPacket[11] = fifoBuffer[29];
teapotPacket[12] = fifoBuffer[32];
teapotPacket[13] = fifoBuffer[33];
teapotPacket[14] = fifoBuffer[36];
teapotPacket[15] = fifoBuffer[37];
Serial.write(teapotPacket, 20);
teapotPacket[17]++; // packetCount, loops at 0xFF on purpose
#endif
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment