Shop OBEX P1 Docs P2 Docs Learn Events
Using a Sparkfun MP3 Trigger with a BS2 — Parallax Forums

Using a Sparkfun MP3 Trigger with a BS2

scary terryscary terry Posts: 24
edited 2013-09-21 20:10 in BASIC Stamp
I'm using a BS2 to trigger audio tracks from a "Sparkfun MP3 Trigger" MP3 player. There are two modes to serially trigger a specific track, ASCII and binary. Here are the details on each one from the user guide:

Command: Trigger (ASCII)
Number of bytes: 2
Command byte: ‘T’
Data byte: N = ASCII ‘1’ through ‘9’
Comments: If it exists, the track with the filename “00Nxxxx.MP3” will be started, where N is the data byte.xxxx can be any valid filename characters of any length.
Command: Trigger (binary)
Number of bytes: 2
Command byte: ‘t’
Data byte: n = 1 to 255
Comments: If it exists, the track with the filename “NNNxxxx.MP3” will be started, where NNN is the ASCII equivalent of the data byte n with leading 0s. xxxx can be any valid filename characters of any length.

I'm able to use the ASCII mode with a command like this: "SEROUT toMP3, Baud, ["T2"]" but that's only good for nine tracks and I need to play more.
I'm trying to use the binary mode but I can't figure out how to format the SEROUT command to play a track. Any ideas on this?
Thanks for your help.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-09-21 18:20
    SEROUT toMP3, Baud, ["t", trackNo]

    trackNo is any variable (or constant or expression for that matter) with a value from 1 to 255.
  • Ron CzapalaRon Czapala Posts: 2,418
    edited 2013-09-21 18:25
    Damn! Mike beat me to it! :smile:


    Try SEROUT toMP3,Baud,["t", track] where n is a byte containing 1 to 255 ( track VAR Byte )
    track VAR Byte
    track=12
    SEROUT toMP3,Baud,["t", track]
    
  • scary terryscary terry Posts: 24
    edited 2013-09-21 20:10
    Thanks Mike and Ron. I could swear that I tried that earlier and it didn't work but now it works fine. I must have done it a little differently. I appreciate it!
    Terry
Sign In or Register to comment.