I’m using an Arduino UNO and a ping sensor with the music shield and need to be able to change the volume within the Arduino IDE. I’ve tried using the command Mp3SetVolume since it’s defined within player.cpp but it has not worked. I’m very new to arduino and coding, so any help available would be greatly appreciated. Also, if anyone knows how to disable a few pins so that I can utilize them to make this arduino a slave for another, I would really appreciate that too. thanks.
Hi there,
Which pin do do you want to disable ? You can delete the code of that pin in the music library.
And if you want to change volume via IDE , you can move the code in library to IDE .Certainly,you should change few code.Here is the code that used to change volume in library.
[code] else if(0 == VUKey)
{
if(–vu_cnt == 0)
{
if (g_volume-- == 0) g_volume = 0; //Change + limit to 0 (maximum volume)
Mp3SetVolume(g_volume,g_volume);
redPwm = (175-g_volume)*3>>1;
if(redPwm >255)
{
redPwm = 255;
}
if(redPwm < 0)
{
redPwm = 0;
}
Serial.println(redPwm,DEC);
Serial.println(1);
vu_cnt = 10000;
}
}
else if (0 == VDKey)
{
if(–vd_cnt == 0)
{
if (g_volume++ == 254) g_volume = 254; //Change + limit to 254 (minimum vol)
Mp3SetVolume(g_volume,g_volume);
redPwm = 305-(g_volume<<1);
if(redPwm >255)
{
redPwm = 255;
}
if(redPwm < 0)
{
redPwm = 0;
}
Serial.println(redPwm,DEC);
Serial.println(2);
vd_cnt = 10000;
}[/code]
arduino-1.0—>libraries—>Music_v1_2 —>player.cpp
Regards,
Deray