To use the node in your project you should have the gabbapeople/mpu6050 library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.
C++ implementation
node {
void evaluate(Context ctx) {
auto mpu = getValue<input_DEV>(ctx);
if (isSettingUp())
emitValue<output_DEVU0027>(ctx, mpu);
if (isInputDirty<input_UPD>(ctx)) {
if (!dmpReady) {
return;
}
while (!mpuInterrupt && fifoCount < packetSize) {}
mpuInterrupt = false;
mpuIntStatus = mpu->getIntStatus();
fifoCount = mpu->getFIFOCount();
if ((mpuIntStatus & 0x10) || fifoCount == 1024) {
mpu->resetFIFO();
} else if (mpuIntStatus & 0x02) {
while (fifoCount < packetSize)
fifoCount = mpu->getFIFOCount();
mpu->getFIFOBytes(fifoBuffer, packetSize);
fifoCount -= packetSize;
}
}
emitValue<output_DONE>(ctx, 1);
}
}