         logs = "motor code set to level to " + input.substring(1);
         break;
       }
-    //LED code
-    case 'L': {
+
+    case 'L': { /*LED codes*/
         char ledValue = codeArray[1];
         int ledDutyCycle = int(charToInt(ledValue) * 25.5);
         analogWrite(ledPin, ledDutyCycle); //sets up PWM on the speedPin

//Watchdog
bool watchdogEnabled = false;
unsigned long watchdogTimer;
unsigned long timeoutTime = 30000;
String recallCode = "M1005";

//Timing

  Serial.println(daqString);
}

unsigned long update_watchdog_timer(){
  /*
   * updates the watchdog timer 
   */
  watchdogTimer = watchdogTimer + ( millis() - lastTime );
  lastTime = millis();
  return watchdogTimer;
}

void memory_check(){
  /*
   * This function just prints out the current amount of free memory possessed by the arduino
   * used only in troubleshooting scenarios
   * 
   * running this method with Goddard will effectively break the MARS controller
   */
  
  Serial.print("freeMemory()=");
  Serial.println(freeMemory()); 
}


void emergency_shutdown(){
  /*
   * This function shuts down the watchdog and turns all pins off (to effectively disengage the motor)
   * 
   * only used in the event that that the arduino has recieved no contact from MARS
   * for a long duration. the arduino assumes that something catastrophic has happened 
   * and MARS is stuck in the tube without any controlling software.
   * 
   */
  watchdogEnabled = false;
  memCheck = false;
  digitalWrite(enablePin, LOW);
  digitalWrite(revPin, LOW);
  digitalWrite(brakePin, LOW);
  digitalWrite(speedPin,LOW);
  digitalWrite(ledPin,LOW);
}

void loop() {
 if (Serial.available() > 0) {
    process_code( retrieve_code() );
 }
 daqTelemetry = daq();
 save_and_send(daqTelemetry);
  
 update_watchdog_timer();
  if(watchdogEnabled == true){
    if(watchdogTimer > recallTime){
      process_code( recallCode );
    }
    else if(watchdogTimer > shutdownTime){
      emergency_shutdown();
    }
  }
  if(memCheck == true){
    memory_check();
  }
  logs = "Null";
  delete daqTelemetry;
}
