 Servo myservo;  // create servo object to control a servo
                 // a maximum of eight servo objects can be created
 
-int currAngle = 135;
+int currAngle = 100;
 
 void setup()
 {
   myservo.attach(9);   // attaches the servo on pin 9 to the servo object
   myservo.write(currAngle);
 
-  // initialize digital pin 13 as an output.
-  pinMode(13, OUTPUT);
+  // initialize diagnostic LED
+  pinMode(LED_DIAG, OUTPUT);
 
   Serial.begin(9600);  // open the serial port at 9600 bps:
+
+  // initialize IR detectors
+  pinMode(IR_LEFT, INPUT); 
+  pinMode(IR_RIGHT, INPUT); 
 
   delay(3000);         // wait long enough to open Serial console
 }

#include <Math.h>
#include <Servo.h>

//
// CONSTANTS
//

// multiply by degrees to get radians
//
const double RADIANS_PER_DEGREE = 0.0174532925;

const int LEFT_LIMIT = 60;
const int RIGHT_LIMIT = 180;

// milliseconds to wait between servo movement: when servo is gently oscillating
const int GENTLE_DELAY = 45;

// milliseconds to wait between servo movement: when servo is shaking back & forth
const int SHAKE_DELAY = 10;

  Serial.println(behaviorMode);

  switch (behaviorMode) {

    case 0:
      currAngle = shakeServo(currAngle, random(2, 4));
      break;

    default:
      currAngle = oscillateGently(currAngle, random(3, 6));
      break;

  }

  // wait random seconds until next loop
