PS2 controller interfacing with MAX/MSP

Hello folks, new member as of today, yay!

So for a university project I plan on using this sketch (below) as a link between arduino and MaxMSP, It works great with pots and buttons on the breadboard but I'd like to use a PS2 controller to adjust the number data within max, could anyone point me in the right direction of how the actual wiring connects?

I've been on this site Arduino Playstation 2 Controller Library Troubleshooting Guide « The Mind of Bill Porter and this one too Interfacing a PS2 (PlayStation 2) Controller - Curious Inventor which are helpful for wire colours but don't really run me through how to connect them to the arduino for use as analog and digital interfaces.

I'm not sure if i'll need the extensive PSX library or not, and if so how to upload that and my max sketch.

please help me, i'm seriously struggling with what is probably an easy connect.

int x=0;
int ledPin = 13;

void setup()
{
Serial.begin(115200);
digitalWrite(13 ,HIGH);
delay(600);
digitalWrite(13,LOW);
pinMode(13,INPUT);
}
void loop()
{
if(Serial.available()>0){
if(Serial.read() == 'r'){
for(int pin =0; pin<=5; pin++){
x=analogRead(pin);
sendValue (x);
}
for (int pin= 2;pin<=13;pin++){
x=digitalRead(pin);
sendValue (x);
}
Serial.println();
delay(5);
}
}
}
void sendValue (int x){
Serial.print(x);
Serial.write(byte(32));
}