     soft_serial_max_peaks();
 
     //ALTERNATE BETWEEN MICROPHONE AND VIBRATION SENSOR
-    if (mic_or_zxy_state == 0){
-      //SWITCH BACK TO VIBRATION X SENSOR
-      mic_or_zxy_state = 1; //set to vibration mode
+    if (is_microphone == true){
+      //SWITCH BACK TO VIBRATION SENSOR
+      is_microphone = false; //set to vibration mode
       down_sampling_rate =20;//vibration mode uses downsampling factor 20
       ADMUX = 0x41; // change it to adc1
       noise_floor = 50;
-    }else if (mic_or_zxy_state == 1){
-      //SWITCH BACK TO VIBRATION X SENSOR
-      mic_or_zxy_state = 2; //set to vibration mode
-      down_sampling_rate =20;//vibration mode uses downsampling factor 20
-      ADMUX = 0x42; // change it to adc1
-      noise_floor = 50;
-
-    }else if (mic_or_zxy_state == 2){
-      //SWITCH BACK TO VIBRATION X SENSOR
-      mic_or_zxy_state = 3; //set to vibration mode
-      down_sampling_rate =20;//vibration mode uses downsampling factor 20
-      ADMUX = 0x43; // change it to adc1
-      noise_floor = 50;
-      
-    }else if (mic_or_zxy_state == 3){
+    }else{
       //SWITCH BACK TO MICROPHONE
-      mic_or_zxy_state = 0; //set to microphone mode
-      down_sampling_rate =0;// microphone mode 
+      is_microphone = true; //set to microphone mode
+      down_sampling_rate =1;// microphone mode 
       ADMUX = 0x40; // use adc0
       noise_floor = 100;
     }
+
+//When TIMSK0 is on: 
+//delay(120000);
   }
 }
 
 
 //////////////////////////////////////////////////////FUNCTIONS/////////////////////////////////////////////////
-//void print_fft(){
-//    Serial.println("Fourier Transform:");
-//    for(int i = 0 ; i < FFT_N/2; i++){
-//      Serial.print(fft_log_out[i]);
-//      Serial.print(",");
-//    }
-//    Serial.println("");
-//}
-//
-//void print_peaks(){ 
-//    Serial.println("3dB Bandwidth:");
-//    for(int i = 0 ; i < FFT_N/2; i++){
-//      Serial.print(peak_power[i]);
-//      Serial.print(",");
-//    }
-//    Serial.println("");
-//}
-//
-//void print_max_peaks(){
-// int scaling_factor = 1; //pos * BW_per_pos
-//  if(mic_or_zxy_state==0){
-//    Serial.println("Microphone Peaks At:");
-//    scaling_factor = 133;
-//  }else if(mic_or_zxy_state==1){
-//    Serial.println("VibrationX Sensor Peaks At:");
-//    scaling_factor = 7;
-//  }else if(mic_or_zxy_state==2){
-//    Serial.println("VibrationY Sensor Peaks At:");
-//    scaling_factor = 7;
-//  }else{
-//    Serial.println("VibrationZ Sensor Peaks At:");
-//    scaling_factor = 7;
-//  }
-// 
-//    for(int i = 0 ; i < number_of_peaks; i++){
-//      if(biggest_peaks[i]!=0){
-//      Serial.print((biggest_peaks[i]+1)*scaling_factor); //Print out the frequency
-//      }else{
-//          Serial.print(0);
-//      }
-//      Serial.print(",");
-//      Serial.print(peak_power[biggest_peaks[i]]); //Print out the power at that peak
-//      Serial.print(",");
-//    }
-//    Serial.println("");
-//}
+
+void print_fft(){
+  
+    Serial.println("Fourier Transform:");
+    for(int i = 0 ; i < FFT_N/2; i++){
+      Serial.print(fft_log_out[i]);
+      Serial.print(",");
+    }
+    Serial.println("");
+  
+}
+
+void print_peaks(){ 
+    Serial.println("3dB Bandwidth:");
+    for(int i = 0 ; i < FFT_N/2; i++){
+      Serial.print(peak_power[i]);
+      Serial.print(",");
+    }
+    Serial.println("");
+}
+
+void print_max_peaks(){
+ int scaling_factor = 1; //pos * BW_per_pos
+  if(is_microphone==true){
+    Serial.println("Microphone Peaks At:");
+    scaling_factor = 133;
+  }else{
+    Serial.println("Vibration Sensor Peaks At:");
+    scaling_factor = 7;
+  }
+ 
+    for(int i = 0 ; i < number_of_peaks; i++){
+      if(biggest_peaks[i]!=0){
+      Serial.print((biggest_peaks[i]+1)*scaling_factor); //Print out the frequency
+      }else{
+          Serial.print(0);
+      }
+      Serial.print(",");
+      Serial.print(peak_power[biggest_peaks[i]]); //Print out the power at that peak
+      Serial.print(",");
+    }
+    Serial.println("");
+}
 
 void find_peaks(){
+
   //Initialize peak arrays
     for (int i = 0; i<FFT_N/2;i++){
     peak_power[i] = 0;



void soft_serial_max_peaks(){
 //Set the scaling factor based on the state
 int scaling_factor = 1; //pos * BW_per_pos
  if(mic_or_zxy_state==0){
//    Serial.println(" Microphone Software Serial Test:");
    scaling_factor = 133;
  }else if (mic_or_zxy_state==1){
//    Serial.println(" Vibration SoftwareX Serial Test:");
    scaling_factor = 7;
  }else if(mic_or_zxy_state==2){
//    Serial.println(" Vibration SoftwareY Serial Test:");
    scaling_factor = 7;
  }else{
//    Serial.println(" Vibration SoftwareZ Serial Test:");
    scaling_factor = 7;
  }


int peak_power[FFT_N/2];

//State Data
boolean is_microphone = true;
int down_sampling_counter = 0;
int down_sampling_rate = 1;

//Print Variables
String data_string = "";

///////////////////////////////////////////////////SETUP////////////////////////////////////////////////////////
void setup() {
  mySerial.begin(4800);
  
 //Pins aren't really needed since we are referencing the ADC MUX directly
//  pinMode(sensorZ, INPUT);
//  pinMode(sensorY, INPUT);
//  pinMode(sensorX, INPUT);
  
  pinMode(digitalSelectPin, OUTPUT);
  digitalWrite(digitalSelectPin, LOW); //Set to HIGH for 6G sensitivity, OR LOW for 1.5G sensitivity
  digitalWrite(digitalSleepPin, HIGH);
  Serial.begin(4800); // use the serial port
  TIMSK0 = 0; //Reduces jitter
  ADCSRA = PS_32_i; //Set Prescaler Value
  ADMUX = 0x40; // use adc0
