Code

download Code

of 1

description

music player Arduino :)

Transcript of Code

  • if ((analogRead(A0) > thresh) && !(MP3player.isPlaying()) ) // if button pressed and file is not playing { uint8_t result = MP3player.playMP3("track001.mp3"); // Play the file playFlag = 1; // set the playflag to 1 } // If button is pressed and file is playing, do nothing: else if ((analogRead(A0) > thresh) && (MP3player.isPlaying()) ) { Serial.println("playing"); } else { if (playFlag) { // if file is playing, stop it and set the playflag to 0 MP3player.stopTrack(); playFlag = 0; } }