I'm using the Single Pixel sketch near the bottom of the page as a base. I'm using a shift register with a 4x4 led array. It also sends midi out to the computer to make sounds. This works fine and dandy on the UNO.
The combination of the two works well on an UNO. But I want to generate the MIDI via the arduino and not on the computer so the device can be liberated!
I found a sketch that enable the shield in "real time midi mode". On it's own I can get it to play midi.
The problem is integrating the midi shield code into my existing code. I switched over to a MEGA 2560 so I had more ports to play with, the MP3 shield takes many. I can get the leds working on the shift register, the I2C working for the gyro/acc and real time midi mode working on the shield, but when I combine them... No go.
I'm new to using ports and interrupts. I'm fairly sure I'm having some kind of timing or interrupt problem but I'm not sure.
I hope everything I write here is correct. I'm not 100% sure.
The MPU-6050 code by Jeff Rowberg used INT0. This is fixed in his code I think.
That is digital pin 2 (D2).
This is the same for an Arduino Uno and an Arduino Mega 2560. http://arduino.cc/en/Main/arduinoBoardMega2560
The I2C is on other pins, but you have that part working.
The MP3 shield used also D2 for MP3-DREQ.
I think the others pins are no problem, but only D2.
Since D3 and D4 are in use with the MP3 shield, you have to use pin 18 (interrupt 5), 19 (interrupt 4), 20 (interrupt 3), or 21 (interrupt 2) of the Arduino Mega 2560.
So the software for one of the shields much be changed for the new pin.
Thanks for the ideas Krodal. I tried some things but still no luck.
I decided to fall back a level of code and eliminate the MP3 shield and focus on using the I2C MPU-6050 and the shift register with the MEGA. Here is the code I'm using:
It worked fine for the first two times and then just stopped working. So there is definitely some conflict with the I2C dev library and my current code. You can see I eliminated the software serial and just use Serial1 on the MEGA. The weird thing is if I let the circuit sit powered up, sometimes after like 30min or so it will spontaneously start working... So I think there is some conflict that sticks this thing in a loop or fights for port access or something. I wrote the Jeff Rowberg to get his input, hopefully he'll be able to point me to something that helps.
If there are anymore ideas out there, please let me know!