This is the only library I found that give pitch and roll angles.
I want to create a function that detect motion, behaving just as the "Detect motion" function in Adafruit's lib for MPU6050.
How could I do this?
Why not use Adafruit' "detect motion" function?
I new to Arduino programming, but can I use two libraries for the same IC? will be there any conflict?
Yes, you can expect conflicts if two libraries attempt access the same module.
Take a look at the "detect motion" code, perhaps you can just include that code, or at least the method, into your own program.
Ok, I will try to modify the Adafruit's lib, thank you.
If anyone passes through, this will be helpful:
void MPU6050::MotionDetectionEnable() {
//writeData(0x37, 0x20);
byte regdata = readData(0x1C);
writeData(0x1C, 0x01 || regdata);
writeData(0x1F, 5);
writeData(0x20, 40);
writeData(0x69, 0x15);
writeData(0x38, 0x40);
}
bool MPU6050::MotionDetectionFlag() {
byte flag = readData(0x61);
flag = flag >> 1;
if (flag > 0)
return true;
else
return false;
}
Based on instructions from: How to enable Motion Detection Interrupt on MPU6050. – Eluke.nl
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.