Hi,
I'm successfully using Bill Porter's mp3 shield library to launch mp3s with an IR controller. I also want a string of ws2801 lights to run at the same time. Since both are using the SPI bus I need to transfer per the code here (the notes indicate that this example also has a shift register on the SPI bus):
//disable interrupts to avoid collisions on the SPI bus between this code //and the MP3player library
MP3player.pauseDataStream();
//shift data
tempIO = SPI.transfer(HIBYTE(output));
tempIO<<8;
tempIO = SPI.transfer(LOBYTE(output));
//latch output on shift registers
digitalWrite(OUTLATCH,LOW);
digitalWrite(OUTLATCH,HIGH);
digitalWrite(OUTLATCH,LOW);
//enable interrupts
MP3player.resumeDataStream();
Here's my attempt, but it's not working and I was hoping someone could point out my errors:
void loop() {
int key = getIRKey();
if (key !=0) {
switch(key) {
case 144: MP3player.playTrack(1); break;
//disable interrupts to avoid collisions on the SPI bus between this code //and the MP3player library
MP3player.pauseDataStream();
colorWipe(Color(0, 0, 0), 500);
colorWipe(Color(10, 10, 10), 20);
colorWipe(Color(50, 50, 50), 10);
colorWipe(Color(100, 100, 100), 20);
colorWipe(Color(150, 150, 150), 10);
colorWipe(Color(200, 200, 200), 10);
colorWipe(Color(255, 255, 255), 20);
colorWipe(Color(100, 100, 100), 20);
colorWipe(Color(10, 10, 10), 10);
colorWipe(Color(0, 0, 0), 10);
//enable interrupts
MP3player.resumeDataStream();
case 145: MP3player.playTrack(2); break;
case 146: MP3player.playTrack(3); break;
case 147: MP3player.playTrack(4); break;
}
}
}
What happens now is that the music will play but he lights won't.
Thanks.