adafruit / Adafruit_MP3

mp3 decoding on arduino
40 stars 17 forks source link

Playing MP3 stops Neopixels from working #18

Open jasonthenderson opened 3 years ago

jasonthenderson commented 3 years ago

Using an Adafruit Titano and trying to both play an MP3 file using Adafruit_MP3 and the Neopixel NeoPatterns class from Adafruit.

I am just doing the RainbowCycle example, it works just fine.

Then, I try playing an MP3 just like in the Play From QSPI example.

Then, I can no longer get any of the neopixels to update.

Neopixels are on D3.

It seems like there is a conflict of some sort?

ladyada commented 3 years ago

maybe IRQs get turned off, could try turning them back on

jasonthenderson commented 3 years ago

Thank you for the suggestion @ladyada, could you please give me some pointers how would I do that? I am using the NeoPatterns class, i.e. NeoPatterns Strand(NUM_LED, DATA_PIN, NEO_RGB + NEO_KHZ800, &strandComplete);

I tried redeclaring the static object after the MP3 played, but that didn't work - no LEDs change color on my setpixel/show code following the mp3 playing (just trying to set a single pixel and show() fails to do anything). Where/how do I turn IRQs on.

jasonthenderson commented 3 years ago

I found a partial workaround based on @ladyada's suggestion. I call delay(2000); 'Strand.setPin(3);

directly after the mp3 finishes and the lights start working (i.e. i redeclare the data pin as 3 after the mp3 finishes to reset the interupt (I think that is what it is doing). If I call setPin without the delay, it doesn't always work.

However, I would really like to be able to run the animations while the music is playing, but to do that need to somehow set the interrupts so they aren't conflicting, vs just overwrite them like I think I'm doing above.? Any ideas on how to do this?