Software Serial question

I am setting up the SparkFun mp3 Trigger board ( on my Arduino mega. I have done it before on other projects using this snippet of code:

  Serial1.begin(38400);   // initialize serial port 1 on the Arduino Mega

  Serial1.write('t');   // play track #1 on the mp3 board

On this new project, all my hardware serial ports are used, so I need to put the mp3 board on Software Serial. I’ve set it up on the Mega’s digital pins 4 and 5. I’ve also set the firmware on the mp3 board to 9600 baud so that it will work with Arduino’s Software Serial.

// Setup Software Serial for MP3 board
#include <SoftwareSerial.h>
#define txPin 4
#define rxPin 5
SoftwareSerial mySerial =  SoftwareSerial(rxPin, txPin);

void setup(void)  

  pinMode(txPin, OUTPUT);
  pinMode(rxPin, INPUT);




Unfortunately, this code isn’t working. The MP3 board is just ignoring the command, like it’s not receiving the instruction “T1” to play track one. I’ve tried removing the “BYTE” option. That doesn’t work either.

I have a feeling that maybe I’m not using Software Serial properly. This is my first time with it. Note that I’m using a Serial.write in first set of code, but I’m using the mySerial.print in the second set of code. Can anyone give me any tips for using SoftwareSerial to replicate what I’m doing in the first set of code? Does it look like I’m doing it properly?


The examples here show " " vs ’ '.
Does that make a difference?

Maybe try the NewSoft Serial library

#include <NewSoftSerial.h>

#define rxPin 4
#define txPin 5
NewSoftSerial mySerial(rxPin, txPin);

void setup() {

pinMode(txPin, OUTPUT);
pinMode(rxPin, INPUT);


Maybe try the NewSoft Serial library

Thank you for the suggestion, Crossroads. I changed over to NewSoftSerial and everything started working perfectly. That solved my problem. :)