SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By eustace
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:
Code: Select all
void startTrack(int track)
  Serial.print('T', BYTE);
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:
Code: Select all
void setVolume(byte vol)
  Serial.print('v', BYTE);
  Serial.print(vol, BYTE);
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.
User avatar
By robertsonics
I'd suggest getting the 't' command working first, then you can be confident that you're sending the correct data values. For volume, any value over 64 (0x40 hex) will produce essentially silence.

There's a thread about using the 't' command with an Arduino at the MakerJam forum here -


This should start TRACK026.MP3, though it's probably not the most efficient way of coding it. Perhaps someone will chime in and explain how to combine into a single write statement.

Once that works...


...should produce full volume. Hope this helps.
By eustace
I read that volume command summary at least twice without the range of values actually sinking in. D'oh! Now I've got ascii & binary track triggering and volume control - everything my project needs. Thanks, and thanks for the link, too.
By jordansears
hey man, i'm having the same problems. would you mind posting your code for this project? i need it to help with my thesis proj!!!

long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]