OWI Crawler Hack - IR Remote

/*
 * IR Remote Library Copyright 2009 Ken Shirriff
 * http://arcfn.com
 *
 */


#include <AFMotor.h>
#include <IRremote.h>
AF_DCMotor motor1(1, MOTOR12_64KHZ); // create motor #1, 64KHz pwm
AF_DCMotor motor2(2, MOTOR12_64KHZ); // create motor #1, 64KHz pwm
AF_DCMotor motor3(3, MOTOR12_64KHZ); // create motor #1, 64KHz pwm

int RECV_PIN = 14;
int irVal;
String working1;
String working2;
//
IRrecv irrecv(RECV_PIN);
decode_results results;

void setup() {
  Serial.begin(9600);
  // In case the interrupt driver crashes on setup, give a clue
  // to the user what's going on.
  Serial.println("Enabling IRin");
  irrecv.enableIRIn(); // Start the receiver
  Serial.println("Enabled IRin");
  motor1.setSpeed(250);     // set the speed to 200/255
  motor2.setSpeed(250);     // set the speed to 200/255
  motor3.setSpeed(250);     // set the speed to 200/255
  forwardF(250);
}


void loop() {
  if (irrecv.decode(&results)) {
    irVal = results.value;
    Serial.println(irVal);
    working1 = dCode(irVal);
     if (working1 != "Repeat") {
      working2 = working1;
    }
    Serial.println(working2);
    irrecv.resume(); // Receive the next value
  }
  delay(100);

  
//  forward(255, 2000);
//  backward(255, 2000);
//  stopIt();
//  lift(255, 5000);
//  lower(100, 6000);
//  stopIt();
//  while (true);
}

void forward(int spd, int dlay) {
  motor1.setSpeed(spd);     // set the speed to 200/255
  motor2.setSpeed(spd);     // set the speed to 200/255
  motor1.run(FORWARD);      // turn it on going forward
  motor2.run(FORWARD);      // turn it on going forward
  delay(dlay);
}
void forwardF(int spd) {
  motor1.setSpeed(spd);     // set the speed to 200/255
  motor2.setSpeed(spd);     // set the speed to 200/255
  motor1.run(FORWARD);      // turn it on going forward
  motor2.run(FORWARD);      // turn it on going forward
}

void rightF(int spd) {
  motor1.setSpeed(spd);     // set the speed to 200/255
  motor2.setSpeed(spd);     // set the speed to 200/255
  motor1.run(FORWARD);      // turn it on going forward
  motor2.run(BACKWARD);      // turn it on going forward
}

void leftF(int spd) {
  motor1.setSpeed(spd);     // set the speed to 200/255
  motor2.setSpeed(spd);     // set the speed to 200/255
  motor1.run(BACKWARD);      // turn it on going forward
  motor2.run(FORWARD);      // turn it on going forward
}
void backward(int spd, int dlay) {
  motor1.setSpeed(spd);     // set the speed to 200/255
  motor2.setSpeed(spd);     // set the speed to 200/255
  motor1.run(BACKWARD);      // turn it on going forward
  motor2.run(BACKWARD);      // turn it on going forward
  delay(dlay);
}
void backwardF(int spd) {
  motor1.setSpeed(spd);     // set the speed to 200/255
  motor2.setSpeed(spd);     // set the speed to 200/255
  motor1.run(BACKWARD);      // turn it on going forward
  motor2.run(BACKWARD);      // turn it on going forward
}

void lift(int spd, int dlay) {
  motor3.setSpeed(spd);     // set the speed to 200/255
  motor3.run(FORWARD);      // turn it on going forward
  delay(dlay);
}
void liftF(int spd) {
  motor3.setSpeed(spd);     // set the speed to 200/255
  motor3.run(FORWARD);      // turn it on going forward
}

void lower(int spd, int dlay) {
  motor3.setSpeed(spd);     // set the speed to 200/255
  motor3.run(BACKWARD);      // turn it on going forward
  delay(dlay);
}
void lowerF(int spd) {
  motor3.setSpeed(spd);     // set the speed to 200/255
  motor3.run(BACKWARD);      // turn it on going forward
}

void stopIt() {
  motor1.run(RELEASE);      // stopped
  motor2.run(RELEASE);      // stopped
  motor3.run(RELEASE);      // stopped
}

String dCode(int val) {
  String ansVal;
  switch (val) {
    case 26775:
      ansVal = "One";
      liftF(255);
      return ansVal;
      break;
    case 15355:
      ansVal = "Two";
      return ansVal;
      break;
    case -20401:
      ansVal = "Three";
      lowerF(255);
      return ansVal;
      break;
    case -16833:
      ansVal = "Four";
      return ansVal;
      break;
    case -7177:
      ansVal = "Five";
      forwardF(255);
      return ansVal;
      break;
    case 539:
      ansVal = "Six";
      return ansVal;
      break;
    case 25979:
      ansVal = "Seven";
      return ansVal;
      break;
    case 15547:
      ansVal = "Eight";
      return ansVal;
      break;
    case -6241:
      ansVal = "Nine";
      return ansVal;
      break;
    case 5499:
      ansVal = "Zero";
      return ansVal;
      break;
    case -521:
      ansVal = "Star";
      return ansVal;
      break;
    case -997:
      ansVal = "Pound";
      return ansVal;
      break;
    case 25245:
      ansVal = "Forward";
      delay(20);
      forwardF(250);
      return ansVal;
      break;
    case -15811:
      ansVal = "Right";
      rightF(255);
      return ansVal;
      break;
    case -22441:
      ansVal = "Reverse";
      backwardF(255);
      return ansVal;
      break;
    case 8925:
      ansVal = "Left";
      leftF(255);
      return ansVal;
      break;
    case 765:
      ansVal = "OK";
      stopIt();
      return ansVal;
      break;
    default:
      ansVal = "Repeat";
      return ansVal;
      break;

  }
}