I have searched the forums and do not see this problem yet. Apologies if I missed it. I am new to programming. I am new to Arduino and Qwiic trigger boards. So far I have created a step up function to gradually increase volume upon intro to song. Now I would like to repeat track one.
#include <Wire.h> //Needed for I2C to Qwiic MP3 Trigger
#include “SparkFun_Qwiic_MP3_Trigger_Arduino_Library.h” //http://librarymanager/All#SparkFun_MP3_Trigger
MP3TRIGGER mp3;
void setup()
{
Serial.begin(9600);
Wire.begin();
if (mp3.begin() == false)
{
delay(6000); //Device may take up to 1500ms to mount the SD card
}
if (mp3.begin() == true); //We’re all setup!
//Check to see if Qwiic MP3 is present on the bus
if (mp3.begin() == false)
{
Serial.println(“Qwiic MP3 failed to respond. Please check wiring and possibly the I2C address. Freezing…”);
while (1);
}
mp3.setVolume(6); //Volume can be 0 (off) to 31 (max)
mp3.playTrack(1); //Begin playing the first track on the SD card
if (mp3.begin() == true)
{
delay(1000);
mp3.setVolume(9); //Volume can be 0 (off) to 31 (max)
delay(1000);
mp3.setVolume(12); //Volume can be 0 (off) to 31 (max)
delay(1000);
mp3.setVolume(15); //Volume can be 0 (off) to 31 (max)
delay(1000);
mp3.setVolume(18); //Volume can be 0 (off) to 31 (max)
delay(1000);
mp3.setVolume(22); //Volume can be 0 (off) to 31 (max)
delay(1000);
mp3.setVolume(25); //Volume can be 0 (off) to 31 (max)
delay(1000);
mp3.setVolume(28); //Volume can be 0 (off) to 31 (max)
delay(1000);
mp3.setVolume(31); //Volume can be 0 (off) to 31 (max)
}
Serial.println(“All done!”);
}
void loop()
{
Serial.println();
Serial.println(“Qwiic MP3 Trigger”);
Serial.println(“1) Play track”);
Serial.println(“2) Play file”);
Serial.println(“3) Play next”);
Serial.println(“4) Play previous”);
Serial.println(“5) Set volume”);
Serial.println(“6) Set EQ”);
Serial.println(“7) Get Song Name”);
Serial.println(“P) Pause/Play from Pause”);
Serial.println(“S) Stop”);
while (Serial.available()) Serial.read(); //Throw away incoming characters
while (Serial.available() == false) delay(10);
Serial.println(“1) Play track”);
mp3.playTrack(1); //Begin playing the first track on the SD card
}
I have copied and pasted most of the script. But I cannot get the track one to repeat. What do I need to do?
After this is accomplished, I would like to have the triggered mp3 play and repeat.
The goal is only upon the first start that the song is quiet and then gradually gets to full volume. After that full volume is required.