Last active
August 28, 2021 13:26
-
-
Save woodif/332e5f99f1cd83d608a8a9765ca981ae to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <SoftwareSerial.h> | |
#include "RedMP3.h" | |
#define MP3_RX 33//RX of Serial MP3 module connect to D7 of Arduino | |
#define MP3_TX 36//TX to D8, note that D8 can not be used as RX on Mega2560, you should modify this if you donot use Arduino UNO | |
MP3 mp3(MP3_RX, MP3_TX); | |
int8_t volume = 0x1a;//0~0x1e (30 adjustable level) | |
int8_t folderName = 0x01;//folder name must be 01 02 03 04 ... | |
int8_t fileName = 0x002; // prefix of file name must be 001xxx 002xxx 003xxx 004xxx ... | |
void setup() | |
{ | |
delay(500);//Requires 500ms to wait for the MP3 module to initialize | |
mp3.setVolume(volume); | |
delay(50);//you should wait for >=50ms between two commands | |
mp3.playWithFileName(folderName,fileName); | |
delay(50); | |
} | |
void loop() | |
{ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment