Bluetooth, Arduino Uno, & MP3Trigger``

First, I am a Arduino n00b, and have tried to find help with the search feature, nothing I have found will help me learn what I am trying to achieve.

Here is what I have setup:

In my Arduino Libraries there is the libraries for both the MP3TriggerV2 and NewSoftSerial10c.

I have installed four mp3 files onto the 2GB memory card, and they play fine using the scroll button on the board.

Also I have a sketch on the Arduino Uno board running some random LEDs, and the LEDs work great.

Using a TTL Bluetooth Board (paired to my PC via Bluetooth connection on Com4) and the UNO connected to my PC via USB (monitored on Com3 via Arduino Serial Monitor set to 38400 baud) I can type back and forth with clean transmission, no odd characters.

At the end of my LED sketch I have inserted the following code:

#include <NewSoftSerial.h>

// Here's the MP3Trigger device connect to pins 2 and 3
NewSoftSerial MP3Trigger(3,2);

This sketch does verify properly, compile and it can be uploaded with zero errors (with those libraries in place).

On the MP3Trigger card I have a MP3TRIGGER.INI file with the following code:

#BAUD 38400
#Q 1

My hopes was that doing this would put the MP3Trigger into Quiet Mode and activate the serial connection (as per the manual).

Now in the terminal windows for both the UNO and Bluetooth (via PC) I can communicate and see the TX/RX LEDs on the UNO light up. There is still the issue on how to activate the sounds on the MP3 Board. Am I doing something really wrong here? What code is it that needs to be sent to actually activate a sound? My guess from the manual is that I have to type into the terminal window:T 1 or ```
MP3Trigger T 1


Can someone please help me figure out what I need to do from here?

Thank you very much in advance!

Tom

A couple of things:

  1. The default baud rate is 38400, so the #BAUD 38400 entry in the init file is unnecessary.

  2. There is no #Q init file command. You can only enter quiet mode using a serial command.

  3. …therefore, you don’t need the init file - it’s not doing anything for you.

  4. The “T” command should only be 2 bytes. Your post makes it appear as though you are inserting a space between the “T” and the “1”.

  5. Try a single byte command first, such as “F”. This not only eliminates the need for sending multiple bytes, but this command doesn’t depend on filenames since it’s the same function as the Forward Navigation Switch. If you can get this command to work, that’s a start. Then try the “T1” command.

Thanks for you help. When I get home I will post up my sketch. Should have done that last night.

Appreciate it!

Tom

MP3Trigger Library is located: https://github.com/sansumbrella/MP3Trig … ino#readme

NewSoftSerial Library is located: http://arduiniana.org/libraries/newsoftserial/

Ledcontrol Lobrary is located: http://www.wayoda.org/arduino/ledcontro … l#Download

#include <MP3Trigger.h>

#include <NewSoftSerial.h>
// TTL BlueTooth module is connected to pins 0 and 1
// MP3Trigger V2 module is connected to pins 2 and 3
NewSoftSerial MP3Trigger(3,2);

#include <LedControl.h>
#undef round 

int cA[] = { B00000110,
             B00001001,
             B00001111,
             B00001001,
             B00001001 };
            
int cB[] = { B00000111,
             B00001001,
             B00000111,
             B00001001,
             B00000111 };

int cC[] = { B00000110,
             B00001001,
             B00000001,
             B00001001,
             B00000110 };

int cD[] = { B0000111,
             B0001001,
             B0001001,
             B0001001,
             B0000111 };

int cE[] = { B00001111,
             B00000001,
             B00000111,
             B00000001,
             B00001111 };
             
int cF[] = { B00001111,
             B00000001,
             B00000111,
             B00000001,
             B00000001 };
             
int cG[] = { B00001110,
             B00000001,
             B00001101,
             B00001001,
             B00000110 };
             
int cH[] = { B00001001,
             B00001001,
             B00001111,
             B00001001,
             B00001001 };
             
int cI[] = { B00000111,
             B00000010,
             B00000010,
             B00000010,
             B00000111 };
             
int cJ[] = { B00001000,
             B00001000,
             B00001000,
             B00001001,
             B00000110 };
             
int cK[] = { B00001001,
             B00000101,
             B00000011,
             B00000101,
             B00001001 };
             
int cL[] = { B00000001,
             B00000001,
             B00000001,
             B00000001,
             B00001111 };
             
int cM[] = { B00010001,
             B00011011,
             B00010101,
             B00010001,
             B00010001 };
             
int cN[] = { B00001001,
             B00001011,
             B00001101,
             B00001001,
             B00001001 };
             
int cO[] = { B00000110,
             B00001001,
             B00001001,
             B00001001,
             B00000110 };
             
int cP[] = { B00000111,
             B00001001,
             B00000111,
             B00000001,
             B00000001 };
             
int cQ[] = { B00000110,
             B00001001,
             B00001101,
             B00001001,
             B00010110 };
             
int cR[] = { B00000111,
             B00001001,
             B00000111,
             B00000101,
             B00001001 };
             
int cS[] = { B0,
             B0,
             B0,
             B0,
             B0 };
int cT[] = { B0,
             B0,
             B0,
             B0,
             B0 };
int cU[] = { B0,
             B0,
             B0,
             B0,
             B0 };
int cV[] = { B0,
             B0,
             B0,
             B0,
             B0 };
int cW[] = { B0,
             B0,
             B0,
             B0,
             B0 };
int cX[] = { B0,
             B0,
             B0,
             B0,
             B0 };
int cY[] = { B0,
             B0,
             B0,
             B0,
             B0 };
int cZ[] = { B0,
             B0,
             B0,
             B0,
             B0 };

LedControl lc=LedControl(12,11,10,3); //assumes only the RLD is connected

char text[] = "HELLO";
int pixelPos=27;
int scrollCount=0;

//virtual coords are 5x27; device coords are 3 panels 6x8 each
unsigned long v_grid[5]; //this will give 5x32 bits

//////////////////////////////////////////////////////////////////////////////////
void setup() 
{
  for(int dev=0;dev<lc.getDeviceCount();dev++)
  {
    lc.shutdown(dev, false); //take the device out of shutdown (power save) mode
    lc.setIntensity(dev, 2); //intensity is 1-15
    lc.clearDisplay(dev);
  }
}

//////////////////////////////////////////////////////////////////////////////////
void loop() 
{
  //Scroll thru the text message one time, then go to random display

  initGrid();  
  if (scrollCount==0)
  {
    scrollingText();
    delay(40);
    return;
  }

  randomDisplay();
  delay(200);
}  



void showGrid()
{
  //copy from virt coords to device coords
  unsigned char col8=0;
  unsigned char col17=0;
  unsigned char col26=0;
  for (int row=0; row<5; row++)
  {
    lc.setRow(0,row, rev(   v_grid[row] & 255L             )   ); //device 0
    lc.setRow(1,row, rev(  (v_grid[row] & 255L<<9) >> 9    )   ); //device 1
    lc.setRow(2,row, rev(  (v_grid[row] & 255L<<18) >> 18  )   ); //device 2
    
    if ( (v_grid[row] & 1L<<8) == 1L<<8)   col8 += 128>>row;
    if ( (v_grid[row] & 1L<<17) == 1L<<17) col17 += 128>>row;
    if ( (v_grid[row] & 1L<<26) == 1L<<26) col26 += 128>>row;
  }
  
  lc.setRow(0, 5, col8);
  lc.setRow(1, 5, col17);
  lc.setRow(2, 5, col26);
}

unsigned char rev(unsigned char b)
{
  //reverse bits of a byte
  return (b * 0x0202020202ULL & 0x010884422010ULL) % 1023;
}

void initGrid()
{
  for (int row=0; row<6; row++) v_grid[row]=0L;
}

void drawLetter(char let, int shift)
{
  int *pLetter;
  switch (let)
  {
    case 'A': pLetter=cA; break;
    case 'B': pLetter=cB; break;
    case 'C': pLetter=cC; break;
    case 'D': pLetter=cD; break;
    case 'E': pLetter=cE; break;
    case 'F': pLetter=cF; break;
    case 'G': pLetter=cG; break;
    case 'H': pLetter=cH; break;
    case 'I': pLetter=cI; break;
    case 'J': pLetter=cJ; break;
    case 'K': pLetter=cK; break;
    case 'L': pLetter=cL; break;
    case 'M': pLetter=cM; break;
    case 'N': pLetter=cN; break;
    case 'O': pLetter=cO; break;
    case 'P': pLetter=cP; break;
    case 'Q': pLetter=cQ; break;
    case 'R': pLetter=cR; break;
    case 'S': pLetter=cS; break;
    case 'T': pLetter=cT; break;
    case 'U': pLetter=cU; break;
    case 'V': pLetter=cV; break;
    case 'W': pLetter=cW; break;
    case 'X': pLetter=cX; break;
    case 'Y': pLetter=cY; break;
    case 'Z': pLetter=cZ; break;
    default:return;
  }
  

  //loop thru rows of the letter
  for (int i=0; i<5; i++) 
  {
    if (shift>0) //positive shift means letter is slid to the right on the display
      v_grid[i] += (long)pLetter[i] << shift;
    else //negative shift means letter is slid to the left so that only part of it is visible
      v_grid[i] += (long)pLetter[i] >> -shift;
  }

}

void scrollingText()
{
  for (int i=0; i<strlen(text); i++)
  {
    drawLetter(text[i], i*5 + pixelPos);
  }

  pixelPos--;
  if (pixelPos < -5*(int)strlen(text))
  {
    pixelPos=27;
    scrollCount++;
  }
  showGrid();

}

void randomDisplay()
{
  for (int device=0; device<3; device++)
    for (int row=0; row<6; row++)
      lc.setRow(device,row,random(0,256));
}