Midi Control and PSX Library

Hello everyone!

I'm new into arudino and I've been doing a series of midi mini projects to learn more about it. It's been a lot of fun and if anyone wants to see the projects so far I uploaded them here: http://stephenkeller.tumblr.com/ (kind of useful to keep track of the things one have done!)

Now I've stumbled trying to make a Playstation controller act as a Midi controller to a synthesizer. The PSX controller is working fine (it sends all the correct data to the serial monitor) and I know the midi protocol and cable is also working. The problem is making the two of them talk to each other.
I believe the issue is due to each of them having a different Serial.begin() data rate: 9600 for the psx and 31.250 for midi. Could this be the problem and I would need an arduino board with more than one Serial connection? I'm working with an Arduino Uno.

This is the code used. I omitted most of the Ifs used for the PSX input for code size sake.

#include <Psx.h> // Includes the Psx Library
Psx Psx; // Create an instance of the Psx library
const int dataPin = 6;
const int cmndPin = 5;
const int attPin = 4;
const int clockPin = 3;
const int psxDelay = 500; // determine the clock delay in microseconds

unsigned int data = 0; // data stores the controller response

int note = 48;

void setup()
{
  // initialize the Psx library
  Psx.setupPins(dataPin, cmndPin, attPin, clockPin, psxDelay);
  Serial.begin(9600); // results will be displayed on the Serial Monitor
}

void loop()
{
  data = Psx.read(); // get the psx controller button data
  // check the button bits to see if a button is pressed
  if(data & psxDown)
    Serial.println("Down button");
    MidiNote(144, note, 127);
    
  if(data & psxLeft)
    Serial.println("Left button");
    MidiNote(144, note+2, 127);
    
  delay(60);
  
  // Note Off
  if(data == 0){
    for(int i = 24; i < 64; i++){
      MidiNote(128, i, 0);
    }
  }
  
}


// MIDI Protocol
void MidiNote(byte channel, byte midinote, byte velocity)
{
  if(data){
    byte midiMessage= 0x90 + (channel - 1);
    Serial.write(midiMessage);
    Serial.write(midinote);
    Serial.write(velocity);
  }
}

Does anyone have any insights into how I could make this work? Thanks!

Could this be the problem

Yes

I would need an arduino board with more than one Serial connection

Yes

I'm working with an Arduino Uno

You could always try software serial to give you an extra port.

This is the code used.

Good.

I omitted most of the Ifs used for the PSX input for code size sake.

Bad.
So this is a snippet.
Try:-
http://snippets-r-us.com/
For help on snippets.

Thank you very much Mike! I'll try using software serial. Just read about it on the reference and the Arduino Cookbook and it seems to be exactly what I was looking for.
Will work on the code later and post it again.
And thanks for the snippet link. I'm new at the forum and it's good to know the common practices used.