Righty then, finally got a chance to rewrite all the code, so it no longer uses any of anybody elses 
// *********************************************************************
// * *
// * This is the software to run a simple iPod control box using *
// * 2 buttons and 2 LEDs. *
// * SERIAL PORT MUST RUN AT 3.3v!! *
// * *
// *********************************************************************
// What the buttons and LEds are hooked up to
#define REDPIN 6
#define GREENPIN 5
#define LEFTBUTTON 3
#define RIGHTBUTTON 4
// Is it time to tell the ipod the button has been released
boolean sendRelease = true;
// Various things to do with the LED fader
boolean greenLedfading = true;
boolean greenLedon = false;
int greenPwm = 255;
boolean redLedfading = true;
boolean redLedon = false;
int redPwm = 255;
long fadeMillis = 0;
#define fadeSpeed 10
// Arrays strings to tell the iPod what to do
const char buttonRelease[] = {
0xFF, 0x55, 0x03, 0x02, 0x00, 0x00,0xFB};
const char dataPlay[] = {
0xFF, 0x55, 0x03, 0x02, 0x00, 0x01, 0xFA, 0x0D};
const char dataPrev[] = {
0xFF, 0x55, 0x03, 0x02, 0x00, 0x10, 0xEB, 0x0D};
const char dataNext[] = {
0xFF, 0x55, 0x03, 0x02, 0x00, 0x08, 0xF3, 0x0D};
void setup()
{
Serial.begin(19200); // Setup the serial port
pinMode(REDPIN, OUTPUT); // Setup the input and output pins
pinMode(GREENPIN, OUTPUT);
pinMode(LEFTBUTTON, INPUT);
pinMode(RIGHTBUTTON, INPUT);
}
void loop()
{
doButtons(); // Service the buttons and tell the iPod what to do
fadeLeds(); // Service the LEDs
}
void doButtons(){
if(digitalRead(LEFTBUTTON) == HIGH || digitalRead(RIGHTBUTTON) == HIGH){ // if a button is pressed
delay(100); // wait 100ms
if(digitalRead(LEFTBUTTON) == HIGH && digitalRead(RIGHTBUTTON) == HIGH){ // if both buttons are now on
iPodPlay(); // Tell the iPod to play/pause
redLedon = true; // Start the red led fading
sendRelease = true; // When both buttons are relesed tell the iPod
return; // Exit the if
}
else if(digitalRead(LEFTBUTTON) == HIGH){ // if left button is on
iPodPrev(); // Tell the iPod to prev track
greenLedon = true; // Start the green led fading
sendRelease = true; // When both buttons are relesed tell the iPod
return; // Exit the if
}
else if(digitalRead(RIGHTBUTTON) == HIGH){ // if left button is on
iPodNext(); // Tell the iPod to next track
greenLedon = true; // Start the green led fading
sendRelease = true; // When both buttons are relesed tell the iPod
return; // Exit the if
}
}
if(digitalRead(LEFTBUTTON) == LOW || digitalRead(RIGHTBUTTON) == LOW && sendRelease == true){ // if all buttons are released and it's time to tell the iPod
iPodRelease(); // tell the iPod the butts have been released
sendRelease = false; // don't tell the iPod again until another button has been pressed
}
}
void iPodPlay(){
for (int i = 0; i < 9; i++) { // Send Play/Pause bytes
Serial.print(dataPlay[i], BYTE);
}
}
void iPodPrev(){
for (int i = 0; i < 9; i++) { //Send Prev bytes
Serial.print(dataPrev[i], BYTE);
}
}
void iPodNext(){
for (int i = 0; i < 9; i++) { //Send Next bytes
Serial.print(dataNext[i], BYTE);
}
}
void iPodRelease(){
for (int i = 0; i < 8; i++) { //Send Button Release bytes
Serial.print(buttonRelease[i], BYTE);
}
}
void fadeLeds(){ // from my library of useful code, need to add comments
// *************************************
if(greenLedon == true){
greenLedon = false;
greenPwm = 255;
analogWrite(GREENPIN, greenPwm);
greenLedfading = true;
}
// *************************************
if(redLedon == true){
redLedon = false;
redPwm = 255;
analogWrite(REDPIN, redPwm);
redLedfading = true;
}
// *************************************
if (millis() - fadeMillis > fadeSpeed) {
int lag = (millis() - fadeMillis) / fadeSpeed;
fadeMillis = millis();
if(greenLedfading == true){
if(greenPwm > 0){
int spaceCount;
for(int i = 1; i <= lag; i++){
greenPwm = greenPwm*100/115;
}
analogWrite(GREENPIN, greenPwm);
}
else{
greenLedfading = false;
}
}
if(redLedfading == true){
if(redPwm > 0){
for(int i = 1; i <= lag; i++){
redPwm = redPwm*100/115;
}
int spaceCount;
spaceCount = redPwm/4;
analogWrite(REDPIN, redPwm);
}
else{
redLedfading = false;
}
}
}
}
Hopefully I'll be able to draw up the hardware soon too, but it really is very simple, even if I did manage to tie the buttons low instead of high ;D oops...
A video of it in action - - YouTube
And lastly a video of what i'm slowly adding functionatly too, and a pointer as to what this is all leading to - - YouTube