I’m using an Arduino to control an Mp3 Trigger, but with limited success. Rather than hard triggering one of seven tracks, I am using the serial connection to trigger individual tracks (so I can play more tracks, of course). I can start a track using the T command, like this:
void startTrack(int track)
{
Serial.print('T', BYTE);
Serial.print(track);
}
This command uses a byte, ‘T’, than an ascii value from 0 to 9, and it works great! I can start a track, no problem. But to access more tracks, I will need to use the ‘t’ command, and send a byte value instead of an ascii value. And I’m afraid to go there. Because I’ve been trying to set the volume with the ‘v’ command, which also accepts a byte value, and every time I use it the volume goes completely away no matter what value is coming out the serial port. Here’s my code:
void setVolume(byte vol)
{
Serial.print('v', BYTE);
Serial.print(vol, BYTE);
delay(500);
}
If I hook the Arduino up to the USB cable and set the speed to 38400 on the monitor, I can see my initial volume value coming over the serial connection, looking like vÿ. I can do this whether I am printing a byte that has been a byte value all along (initializing a byte variable from the top of the code) or whether I cast an int into a byte at some point along the way (like at the Serial.print point). But I can’t get the board to do anything but turn the volume all the way down regardless of value. I would be pulling my hair out over this if I still had hair.
To keep things simple, I’ve been avoiding a two-way serial link between the mp3 trigger and my Arduino. Maybe I need to be reading it’s output to debug this problem, but I thought I would post here first.