Reproducing sounds
Technical References/Sound 2007. 9. 21. 19:47수업시간에 사용된 MP3 Player Module은 대만 회사인 Future Technology Devices International 의 VMusic1 MP3 Test Module 이다. 본 모듈의 사용명령어는 다음의 사이트에서 찾을 수 있다. http://www.vinculum.com/
Code example to play from MP3 players
There exist a whole range of MP3 players that can be controlled from the serial port in a microcontroller. In this example we will use a new type of player that can play files stored in a USB-flash disk.
//MP3 control
int skipPin = 12;
int playPausePin = 13;
int val = 1;
int isPlaying = 0;
int isBeginning = 1;
void setup(){
Serial.begin(9600);
pinMode(skipPin, INPUT);
pinMode(playPausePin, INPUT);
}
void loop(){
val = digitalRead(playPausePin);
if(val == LOW){
if(isBeginning == 1){
Serial.print("V3A"); //play all files
Serial.print(13,BYTE);
isPlaying = 1;
isBeginning = 0;
delay(500);
}else{
if(isPlaying == 1){
Serial.print("E"); //pause
isPlaying = 0;
delay(500);
}else{
Serial.print(13,BYTE); //resume
isPlaying = 1;
delay(500);
}
}
}
val = digitalRead(skipPin);
if(val == LOW){
if(isPlaying == 1){
Serial.print("VSF"); //Skip forward one track
Serial.print(13,BYTE);
isPlaying = 1;
delay(500);
}
}
}