The code worked on my Ardino Uno. I plugged it up the exact same way and am now getting an error.
Here is the error I get when I try to upload my code to the due:
Arduino: 1.8.5 (Windows 10), Board: "Arduino Due (Programming Port)"
C:\Program Files (x86)\Arduino\libraries\SFEMP3Shield\SFEMP3Shield.cpp: In static member function 'static void SFEMP3Shield::refill()':
C:\Program Files (x86)\Arduino\libraries\SFEMP3Shield\SFEMP3Shield.cpp:1984:7: error: 'sei' was not declared in this scope
sei();
^
C:\Program Files (x86)\Arduino\libraries\SFEMP3Shield\SFEMP3Shield.cpp:2006:9: error: 'cli' was not declared in this scope
cli(); // allow transfer to occur with out interruption.
^
C:\Program Files (x86)\Arduino\libraries\SFEMP3Shield\SFEMP3Shield.cpp: In member function 'void SFEMP3Shield::SendSingleMIDInote()':
C:\Program Files (x86)\Arduino\libraries\SFEMP3Shield\SFEMP3Shield.cpp:2053:7: error: 'cli' was not declared in this scope
cli(); // allow transfer to occur with out interruption.
^
C:\Program Files (x86)\Arduino\libraries\SFEMP3Shield\SFEMP3Shield.cpp:2067:7: error: 'sei' was not declared in this scope
sei(); // renable interrupts for other processes
^
exit status 1
Error compiling for board Arduino Due (Programming Port).
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Here is my code:
#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>
#include <SFEMP3Shield.h>
SdFat sd;
SFEMP3Shield MP3player;
const uint8_t volume = 10; // MP3 Player volume 0=max, 255=lowest (off)
//10 for normal 50 for testing
const uint16_t monoMode = 1;
void setup() {
initSD();
initMP3Player();
}
void loop() {
if(!MP3player.isPlaying()){
MP3player.playTrack(1);
}
}
void initSD() {
if(!sd.begin(SD_SEL, SPI_HALF_SPEED))
sd.initErrorHalt();
if(!sd.chdir("/"))
sd.errorHalt("sd.chdir");
}
void initMP3Player() {
uint8_t result = MP3player.begin();
MP3player.setVolume(volume, volume);
MP3player.setMonoMode(monoMode);
}