output + I2C problem

Hello everybody,
I’m using Arduino with MPU6050 and I have all the files to do it, and it went well, but I wanna add at the same time, to the code of MPU6050_DMP6, instructions for PWM to generate this signal from pin 11, the two work with no problem, but don’t work together, when I add the pwm instructions, the motor rotates but the Microcontroller doesn’t receive any data.

any suggestions please ?

Hi, welcome to the forum.

Which Arduino board do you use ? An Arduino Uno ? Pin 11 is part of the SPI bus, but I assume that you don't use SPI. Pin 11 uses also TIMER2, that should also be no problem.

I assume that you don't use Processing, but the normal DMP6 sketch of the i2cdevlib ? https://github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/Examples/MPU6050_DMP6/MPU6050_DMP6.ino

Perhaps something is wrong in the sketch. Could you take a quick look at this : http://forum.arduino.cc/index.php/topic,148850.0.html Number '7' is about using code tags when you paste your sketch into a post.

I'm actually using Arduino Leonardo, it already contains I2C pins on it, and now it's just getting worse because it doesn't even connect, and the monitor hangs in "Initializing I2C devices..." which means it doesn't even execute the function that comes after (mpu.initialize();)

Arduino Leonardo : http://www.arduino.cc/en/Main/ArduinoBoardLeonardo

The I2C is on pin 2 and 3. The pins 2 and 3 are also connected to pin SDA and pin SCL. That means that you can't use pin 2 and 3 for other things.

Run the i2c_scanner : http://playground.arduino.cc/Main/I2cScanner The i2c_scanner should work before you can do anything else.

If the i2c_scanner is okay, the interrupt from the MPU-6050 has to connected to the Leonardo to make the 'dmp' sketch work. Which pin do you use for the interrupt ? and did you change the library for that ?