I'm using the code for the MP3 Shield music box. I worked out all the other errors. This is the code:
//SFEMP3Library author Bill Porter
//SFEMP3Library author Michael P. Flaga
/* MP3 Player Shield Music Box Code Example:
SparkFun Electronics, Pamela, 1/24/2013
Beerware License
Hardware Connections:
-LED = D3 on MP3 Player Shield;
-Motor = D5 on MP3 Player Shield;
-Reed Switch = D4 on MP3 Player Shield;
-Mono Audio Amp Breakout Board Shutdown Pin = D10 on MP3 Player Shield;
You will need to solder header pins to the MP3 Player Shield.
Put the shield on top of an Arduino Uno.
Usage:
When the door opens, the motor will spin and a sound file will play.
The sound file will loop.
Then when the door closes the motor stops spinning and a new track plays one time. */
#include <SPI.h>
//Add the SdFat Libraries
#include <SdFat.h>
//and the MP3 Shield Library
#include <SFEMP3Shield.h>
SFEMP3Shield MP3player;
int led = 3;
int motor = 5;
int reedSwitch = 4;
int speaker = 10;
int fadeAmount = 5;
int brightness = 0;
boolean active = false;
void setup() {
pinMode(motor, OUTPUT); //Motor
pinMode(led, OUTPUT); // LED
pinMode(reedSwitch, INPUT); //Reed Switch
pinMode(speaker, OUTPUT); //Speaker Enable
analogWrite(led, 0); //LED off
digitalWrite(reedSwitch, HIGH); //turn on internal pullups for reed input
digitalWrite(motor, LOW); //Motor off
MP3player.begin();
MP3player.setVolume(0x00, 0x00); //set volume
}
void loop() {
if (digitalRead(reedSwitch) == HIGH && !active)//when door opens
{
active = true;
analogWrite(led, 80);
digitalWrite(speaker, HIGH);
digitalWrite(motor, HIGH);
MP3player.stopTrack();
MP3player.playTrack(3);
}
else if (digitalRead(reedSwitch) == LOW && active)//when door closing
{
active = false;
MP3player.stopTrack();
MP3player.playTrack(2);
digitalWrite(motor, LOW);
analogWrite(led, 255);
}
else if (digitalRead(reedSwitch) == LOW) //while door is closed
{
analogWrite(led, 0);
digitalWrite(motor, LOW);
}
else
{
MP3player.playTrack(1);
analogWrite(led, brightness);
if (brightness == 0 || brightness == 255) {
fadeAmount = -fadeAmount;
}
brightness += fadeAmount;
}
delay(100);
}
I can't figure out what this error means:
Arduino: 1.8.9 (Windows Store 1.8.21.0) (Windows 10), Board: "Arduino Uno"
C:\Users\EMELIO FAMILY\Documents\Arduino\libraries\SFEMP3Shield\SFEMP3Shield.cpp: In member function 'uint8_t SFEMP3Shield::vs_init()':
C:\Users\EMELIO FAMILY\Documents\Arduino\libraries\SFEMP3Shield\SFEMP3Shield.cpp:292:34: warning: ISO C++ forbids converting a string constant to 'char*' [-Wwrite-strings]
if(VSLoadUserCode("patches.053")) return 6;
^
C:\Users\EMELIO~1\AppData\Local\Temp\ccOiK9DN.ltrans0.ltrans.o: In function `begin':
C:\Users\EMELIO FAMILY\Documents\Arduino\libraries\SFEMP3Shield/SFEMP3Shield.cpp:141: undefined reference to `sd'
collect2.exe: error: ld returned 1 exit status
exit status 1
Error compiling for board Arduino Uno.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.