Shop OBEX P1 Docs P2 Docs Learn Events
MP3 trigger communication — Parallax Forums

MP3 trigger communication

Luis_PLuis_P Posts: 246
edited 2012-02-21 08:52 in BASIC Stamp
Hi:
I have the MP3 Trigger from spurkfun electronics. The mp3 plays when you pull a trigger (button switch) they say the BS2 can receive a message from the mp3 player with the trigger number that was pressed (18 triggers) and that’s what I need. I need a head start on this project. The manual says I have to send “Quite mode on” command first like this:

Command: Quiet Mode (ASCII)
Number of bytes: 2
Command byte: ‘Q’
Data byte: N = ASCII ‘0’ or ‘1’
Comments: If N=’1’, Quiet mode is turned on. If N=’0’, Quiet mode is turned off. Default state is off.

What code can I use on the BS2 to enter in quit mode? SEROUT, BAUD ………..?

To receive the message from the MP3trigger telling me what trigger was pressed in the manual they have:

In Quiet Mode only, when one or more trigger inputs are activated, the MP3 Trigger v2 sends ‘M’ followed by a 3-byte bit mask indicating which triggers were activated:
Data byte 0: TRIG01 through TRIG08
Data byte 1: TRIG09 through TRIG16
Data byte 2: TRIG17 and TRIG18
A value of 1 in a bit position indicates that the corresponding trigger input was activated.

Now what code the BS2 needs to detect the incoming message? How the Bs2 will know a message is coming and read the trigger number?

I know Mike Green can do this easily :)
Gratzie tutti !


MP3_Trigger_V2.5_User_Guide.pdf

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2012-02-17 08:42
    I didn't look at the manual for this device, but to send the command you're asking about you could use the following code:
    SEROUT Dpin, Baud, ["Q", $01]
    
  • Luis_PLuis_P Posts: 246
    edited 2012-02-17 15:06
    I didn't look at the manual for this device, but to send the command you're asking about you could use the following code:
    SEROUT Dpin, Baud, ["Q", $01]
    


    Thanks. And how to received the message from this unit. Works when someone press a trigger then sends the trigger number. How do I tell the BS2 to be alert of that?
  • Luis_PLuis_P Posts: 246
    edited 2012-02-19 07:43
    I can't make to work. I think the problem is the BASIC Stamp can communicate at 7 data bits only , 1 stop bit or 8 data, no parity, and 1 stop bit.
    I found that somewhere on this forum. Can you help? The manual of Mp3 trigger as for 8 data pits, 1-stop, 1-start, no parity. What is all that? can I do it with the Bs2?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2012-02-21 08:52
    Hello,

    THE BS2 can handle 8 data bits, 1 stop bit and no parity. See the SERIN command in the BASIC Stamp Manual or Help File. You can receive one or more bytes if you're expecting them after the SEROUT that sends the command. Bear in mind that you will need to set the timeout on the SERIN if you want to interleave checking for incoming data and checking a button press on the BASIC Stamp or other events since the BASIC Stamp can only do one thing at a time and without the timeout, the SERIN will wait indefinitely for data.
Sign In or Register to comment.