 
 StuLaser laser(5);
 
-
+int switchState = 0;
 
 void setup() {
-
+  pinMode(switchPin, INPUT);
   Serial.begin(BAUD_RATE);
+  pinMode(ledPin, OUTPUT);
+  digitalWrite(ledPin, HIGH);
+  delay(100);
+  digitalWrite(ledPin, LOW);
+  delay(100);
+  digitalWrite(ledPin, HIGH);
+  delay(100);
+  digitalWrite(ledPin, LOW);
+  delay(100);
+  digitalWrite(ledPin, HIGH);
+  delay(100);
+  digitalWrite(ledPin, LOW);
+
+  
+  
+  switchState = digitalRead(switchPin);
+   if (switchState == LOW) {
+    // turn LED off:
+    digitalWrite(ledPin, HIGH);
+    sleepState = 1;
+    //attachInterrupt(0, wake, RISING);
+    while(digitalRead(switchPin) == LOW){
+      millis();
+    }
+  }
+  else {
+    // turn LED on:
+    digitalWrite(ledPin, LOW);
+   // attachInterrupt(0, sleepInt, FALLING);
+  }
+
 
   panTilt.begin();
   laser.begin();
-
+  
   panTiltX.angle = panTiltX.minAngle;
   panTiltY.angle = panTiltY.minAngle;
   panTilt.updateAngles();

  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){

  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;
