Introduction: Hexbug Spider Whisker Sensors/ My First Instructable

About: Sysadmin by day, evil genius by night.
My youngest son has a bunch of these Hex bugs (and got a bunch more for Christmas) and gave me one that I had repaired a broken leg on several times. I found https://www.instructables.com/id/Arduino-Spider/ but there wasn't any code and I just got an Arduino Uno for Christmas but no Ultrasonic Sensor. I decided to make whisker sensors/switches for my hex bug. 

Parts:
Arduino Uno
wire (to extend the motor wires)
guitar string (or suitable substitute that is springy) 
2x 10k resistors 
I clipped the leads off of a diode for the vertical post (improvise as needed)
soldiering iron

Step 1: Motor Connections

https://www.instructables.com/id/Arduino-Spider/ is what I used as my reference. On my unit the black wires I used as ground, the white wires I used for the digital outputs. As Creagon did, I extended the wires from the motors. I taped the Uno and feeler board to the top of the hex bug. I found the "forward" motor is the one on the left while looking at the off/a/b switch. I removed the IR sensor and control board. 

Step 2: CODE

//constants
const int ledPin = 13; //built in led
const int bumpLeft = 2; //bump switch left
const int bumpRight = 4; //right switch pin
const int servoFw = 10; //forward movement motor
const int servoTrn = 8; //turning motor


int pbLeft = 0; //var for right
int pbRight = 0; //var for left

void setup() {
  pinMode (bumpLeft, INPUT);
  pinMode (bumpRight, INPUT);
  pinMode (ledPin, OUTPUT);
  pinMode (servoFw, OUTPUT);
  pinMode (servoTrn, OUTPUT);
}

void loop() {
  forward(); //start forward
  //test switch
  pbLeft = digitalRead(bumpLeft);
  pbRight = digitalRead(bumpRight);
 
  //show LED indicator
  showLED();
 
  //if left hit
  if (pbLeft == HIGH) {
    reverse();
    delay(500);
    turnRight();
    delay(1500);
  }
 
  //if right hit
  if (pbRight == HIGH) {
    reverse();
    delay(500);
    turnLeft();
    delay(1500);
  }
}
 
  //Motion routines
  void forward() {
    digitalWrite (servoFw, HIGH);
    digitalWrite (servoTrn, LOW);
  }
 
  void reverse() {
    digitalWrite(servoFw, LOW);
    digitalWrite (servoTrn, HIGH);
  }
 
  void turnRight() {
    digitalWrite(servoFw, LOW);
    digitalWrite(servoTrn, HIGH);
  }
 
  void turnLeft() {
   digitalWrite(servoFw, LOW);
   digitalWrite(servoTrn, HIGH);
  }
 
  void showLED() {
    //show led if bumper hit
    if (pbRight == HIGH || pbLeft == HIGH) {
    //turn led on
    digitalWrite(ledPin, HIGH);
    }
  else {
  //turn LED off
  digitalWrite(ledPin, LOW);
  }
  }

Step 3: Final Words

I will probably redue this "ible" but for now here it is, any ?'s I will try to answer.