I send a signal with the transmitter 434, the receiver receives the signal but the mp3 shield doesn't play the music.
If I teste each one separately, they work correctly.
#include <VirtualWire.h>
#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>
#include <SFEMP3Shield.h>
SdFat sd;
SFEMP3Shield MP3player;
const int led = 12;
int resultado;
void setup() {
vw_set_ptt_inverted(true); // Required for DR3100
vw_set_rx_pin(13);
vw_setup(1000); // Bits per sec
pinMode(led, OUTPUT);
vw_rx_start(); // Start the receiver PLL running
if(!sd.begin(SD_SEL, SPI_HALF_SPEED)) sd.initErrorHalt();
if(!sd.chdir("/")) sd.errorHalt("sd.chdir");
resultado = MP3player.begin();
if(resultado != 0) {
Serial.print(F("Codigo de erro: "));
Serial.print(resultado);
Serial.println(F(" ao tentar tocar a musica"));
if(resultado == 6 ) {
Serial.println(F("Atencao: Plugins não encontrados."));
}
}
}
void loop() {
uint8_t buf[VW_MAX_MESSAGE_LEN];
uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen)) // Non-blocking
{
if(buf[0]=='1'){
digitalWrite(led,HIGH);
MP3player.setBitRate(192);
MP3player.setVolume(10,10);
MP3player.playTrack(1);
}
if(buf[0]=='0'){
digitalWrite(led,LOW);
}
}
delay(10000);
}