   //has enough time passed to update everything?
   if (curTime_millis < lastUpdate_millis) lastUpdate_millis = 0; //handle wrap-around of the clock
   if ((curTime_millis - lastUpdate_millis) > updatePeriod_millis) { //is it time to update the user interface?
-      potentiometer_value = ((float32_t)analogRead(POT_PIN)) / 1024.0;
-  
-      lastUpdate_millis = curTime_millis;
+    potentiometer_value = ((float32_t)(audioHardware.readPotentiometer())) / 1023.0;
+    lastUpdate_millis = curTime_millis;
   } // end if
 } //end servicePotentiometer();
 
 
 //This routine prints the current and maximum CPU usage and the current usage of the AudioMemory that has been allocated
 void printCPUandMemory(unsigned long curTime_millis, unsigned long updatePeriod_millis) {
-  //static unsigned long updatePeriod_millis = 3000; //how many milliseconds between updating gain reading?
   static unsigned long lastUpdate_millis = 0;
 
   //has enough time passed to update everything?

    Serial.print("%/");
    Serial.print(audio_settings.processorUsageMax());
    Serial.print("%,   ");
    Serial.print("Dyn MEM Int16 Cur/Peak: ");
    Serial.print(AudioMemoryUsage());
    Serial.print("/");
    Serial.print(AudioMemoryUsageMax());
    Serial.print(",   ");
    Serial.print("Dyn MEM Float32 Cur/Peak: ");
    Serial.print(AudioMemoryUsage_F32());
    Serial.print("/");

AudioConnection_F32       patchcord3(i2s_in, 0, i2s_out, 0);    //echo audio to output
AudioConnection_F32       patchcord4(i2s_in, 1, i2s_out, 1);    //echo audio to output

// Create variables to decide how long to record to SD
SDAudioWriter_SdFat my_SD_writer;

// define the setup() function, the function that is called once when the device is booting
const float input_gain_dB = 15.0f; //gain on the microphones
float32_t potentiometer_value = 0.0f;  //set in Service Potentiometer
void setup() {
  //begin the serial comms (for debugging)
