Hello,
I use the Lib "MPU6050" in a project. Everything works fine.
But the MPU setup runs in the main (ino) file. The MPU data
read from the main loop. (See MPU6050 example).
I want the MPU6050-Lib in a separate project class
to use.
Looks like this:
void IMUClass::init() (from main setup)
{
Serial.println(F("Initializing I2C devices..."));
mpu.initialize();
etc.
}
void IMUClass::readMPU()(from main loop)
{
mpuInterrupt = false;
mpuIntStatus = mpu.getIntStatus();
fifoCount = mpu.getFIFOCount();
etc.
}
If I all includes (MPU6050_9Axis_MotionApps41.h …), declarations and initializations in my class
have defined, comes this message.
Compiling 'MPU9150_Test' for 'Arduino Mega 2560 or Mega ADK'
MPU9159Class.cpp.o:In function `MPU6050::dmpGetAccel(long*, unsigned
char const*)'
MPU6050_9Axis_MotionApps41.h:dmpGetAccel(long*, unsigned char const*)'
MPU9150_Test.cpp.o:\MPU6050_9Axis_MotionApps41.h:636: first defined here
ld.exe:Disabling relaxation: it will not work with multiple definitions
I understand what the compiler says, but how do I disable the error?
The Libs
#include "MPU6050_9Axis_MotionApps41.h"
#include "helper_3dmath.h"
#include "I2Cdev.h"
located in the project directory. I work with VS + Visual Micro and Arduino IDE.
I'm really desperate.
Regards
Willi