With an MP3 shield, .mp3 files that were previously saved on a FAT32 micro SD card can be played.
The mp3 Shield VS1053
Note: The SD card must be in FAT32 format. Left-click on the removable drive and select "Format." In the window that opens, select "FAT32" under "File System."
ตัวอย่าง
Library
โคดตัวอย่าง
#include <SPI.h>// libraries
#include <SdFat.h>
#include <vs1053_SdFat.h>
SdFatsd; // Name the SD card
vs1053 MP3player; // Name the MP3 Shield as "MP3Player"
intt=6000; // The value for "t" specifies the time interval between playing files in the code.
voidsetup() {
if(!sd.begin(SD_SEL, SPI_FULL_SPEED)) sd.initErrorHalt(); // Read SD card with MP3 files
if (!sd.chdir("/")) sd.errorHalt("sd.chdir");
MP3player.begin(); // Start MP3 Shield
MP3player.setVolume(1,1); // Set the volume
}
voidloop() {
MP3player.available();
MP3player.playTrack(1); // The MP3 Shield now plays the MP3 file named "track001".