This sketch REQUIRES damurdock's mod to Teensyduino to work fully on a PS3 console.
If you don't care about that, you should comment out everything dealing with pin 10.
It has two options for SOCD cleaners, last win and neutral.
I built this for a Teensy LC. It uses pins 0-14 (the pins are labeled in the .ino) and a switch to change between DPad and Left Stick. Buttons should be connected to a ground and the pin.