   delay(2000);
 
   Serial.println("setup complete");
+//  attachInterrupt(0, sleepInt, FALLING);
 }
 
 
 
 void loop() {
+  
+  if(digitalRead(switchPin) == LOW){
+
+    laser.fire(0);
+    digitalWrite(ledPin, HIGH);
+    panTiltX.angle = panTiltX.midAngle;
+    panTiltY.angle = panTiltY.midAngle;
+    panTilt.updateAngles();
+    
+    delay(50);
+//    attachInterrupt(0, wake, RISING);
+
+    panTilt.detach();
+    while(digitalRead(switchPin) == LOW){
+      delay(10);
+     
+    }
+    digitalWrite(ledPin, LOW);
+    panTilt.begin();
+    laser.fire(1);
+    
+  }
+  //attachInterrupt(0, sleepInt, FALLING);
   randomSeed(analogRead(0));
   static unsigned long timePassed;
   static int changeVal;

  unsigned int delayVal = random(minSec, maxSec);
  laser.fire(0);
  panTilt.detach();
  unsigned long startTime = millis();
  for(unsigned long i = 0; i < delayVal; i++){
    while(millis() - startTime < 1000){


#define DIRECTION_CHANGE_PROBABILITY 15

volatile int sleepState = 0;
const int ledPin =  4;      // the number of the LED pin


void sleepInt(){
  detachInterrupt(0);
  sleepState = 1;
  digitalWrite(ledPin, HIGH);

  
}

void wake(){
  detachInterrupt(0);
 sleepState = 0;

digitalWrite(ledPin, LOW); 
 
}


#define BAUD_RATE 115200

const int switchPin = 3;     // the number of the pushbutton pin


//X Position: lower numbers == Right
