     oldTime = mSeconds;
   }
 }
+
+void shake(){
+  panTiltY.angle += 1;
+  panTilt.updateAngles();
+  delay(50);
+  panTiltY.angle -= 1;
+  panTiltX.angle += 1;
+  panTilt.updateAngles();
+  delay(50);
+  panTiltY.angle -= 1;
+  panTiltX.angle -= 1;
+  panTilt.updateAngles();
+  panTiltY.angle += 1;
+  panTiltX.angle -= 1;
+  panTilt.updateAngles();
+  delay(50);
+  panTiltX.angle += 1;
+  panTilt.updateAngles();
+  delay(50);
+}

}

int getMarkovSpeed(int oldSpeed){
  int val = random(101);
  int lowVal, midVal, hiVal;

  if(oldSpeed == 1){
    if(val < 20){
      return 3;
    }
    else{
      return 1;
    }
  }

  else if(oldSpeed == 3){
    if(val < 20){
      return 5;
    }
    else if(val < 70){
      return 3;
    }
    else{
      return 1;
    }
  }

  else if(oldSpeed == 5){
    if(val < 20){
      return 3;
    }
    else{
      return 5;
    }
  }

  else{
    return constrain(oldSpeed, 1, 5);
  }
}



  panTiltX.angle = getDeltaPosition(&panTiltX, changeVal, DIRECTION_CHANGE_PROBABILITY) + panTiltX.angle;

  panTiltY.angle = getDeltaPosition(&panTiltY, changeVal, DIRECTION_CHANGE_PROBABILITY) + panTiltY.angle;


