void modeDescriptors(){ Serial.println(F("Enter 'C' to enter calibration sensors.")); Serial.println(F("Enter 'D' to disable sensors.")); Serial.println(F("Enter 'E' to enable sensors.")); Serial.println(F("Enter 'A' to toggle the display of the sensor accuracy values.")); Serial.println(F("Enter 'O' to toggle the display of the sensor output values.")); } /************************************************************************** Selector for entering calibration "mode" **************************************************************************/ void checkModes(){ if(Serial.available()) { byte incoming = Serial.read(); switch (incoming) { case 'C': case 'c': calibrationMode(); break; case 'D': case 'd': disableMode(); break; case 'E': case 'e': enableMode(); break; case 'A': case 'a': if(showAccuracy==false){ showAccuracy=true; } else { showAccuracy=false; } break; case 'O': case 'o': if(showData==false){ showData=true; } else { showData=false; } break; default: {} } } } /************************************************************************** Calibrate Sensors Mode **************************************************************************/ void calibrationMode() { // This subroutine implements logic related to calibration bool calibrating = true; Serial.println(F("\nCalibration Mode:")); Serial.println(F("Enter the number of the sensor to calibrate")); Serial.println(F("or 'd' when you are Done calibrating.")); while (calibrating == true) { // Check serial input if(Serial.available()) { byte incoming = Serial.read(); switch(incoming) { case '1': if(IMU1Present) { Serial.println(F("Calibrating Sensor 1")); calibrate_sensor(IMU1); Serial.println(F("Sensor Calibrated")); } else { Serial.println(F("Sensor 1 not present")); } break; case '2': if(IMU2Present) { Serial.println(F("Calibrating Sensor 2")); calibrate_sensor(IMU2); Serial.println(F("Sensor Calibrated")); } else { Serial.println(F("Sensor 2 not present")); } break; case 'D': case 'd': Serial.println(F("Done Calibrating")); calibrating = false; break; default: { } } } } } /************************************************************************** Disable Sensors Mode **************************************************************************/ void disableMode() { // This subroutine implements logic related to calibration bool disabling = true; Serial.println(F("\nDisable Mode:")); Serial.println(F("Enter the number of the sensor to disable")); Serial.println(F("or 'd' when you are Done.")); while (disabling == true) { // Check serial input if(Serial.available()) { byte incoming = Serial.read(); switch(incoming) { case '1': if(IMU1Present) { Serial.println(F("Disabling Sensor 1")); IMU1Present = false; } else { Serial.println(F("Sensor 1 not present")); } break; case '2': if(IMU2Present) { Serial.println(F("Disabling Sensor 2")); IMU2Present = false; } else { Serial.println(F("Sensor 2 not present")); } break; case 'D': case 'd': Serial.println(F("Done Disabling")); disabling = false; break; default: { } } } } } /************************************************************************** Enable Sensors Mode **************************************************************************/ void enableMode() { // This subroutine implements logic related to calibration bool enabling = true; Serial.println(F("\nEnable Mode:")); Serial.println(F("Enter the number of the sensor to enable")); Serial.println(F("or 'd' when you are Done.")); while (enabling == true) { // Check serial input if(Serial.available()) { byte incoming = Serial.read(); switch(incoming) { case '1': if(!IMU1Present) { if (enable_sensor(IMU1,0x4B)) { Serial.println(F("Sensor 1 Enabled")); IMU1Present = true; } else { Serial.println(F("Sensor 1 Failed")); } } else { Serial.println(F("Sensor 1 is present")); } break; case '2': if(!IMU2Present) { if (enable_sensor(IMU2,0x4A)) { Serial.println(F("Sensor 2 Enabled")); IMU2Present = true; } else { Serial.println(F("Sensor 2 Failed")); } } else { Serial.println(F("Sensor 2 is present")); } break; case 'D': case 'd': Serial.println(F("Done Enabling")); enabling = false; break; default: { } } } } }