   //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?

 *    >>> START recording by having potentiometer turned above half-way
 *    >>> STOP recording by having potentiometer turned below half-way
 * 
 * Assumes use of Teensy 3.6 and Tympan Rev A or C
 * 
 * Uses super-fast SD library that is originall from Greiman, but which
 *    has been forked, made compatible with the Teensy Audio library, and
 *    included as part of the Tympan Library.
 * 
 * Created: Chip Audette, OpenAudio, March 2018
 * 
 * License: MIT License, Use At Your Own Risk
 */

  //Set the desired input gain level
  audioHardware.setInputGain_dB(input_gain_dB); // set input volume, 0-47.5dB in 0.5dB setps
  
  //Set the state of the LEDs
  audioHardware.setRedLED(HIGH);
  audioHardware.setAmberLED(LOW);
  
  // check the volume knob
  servicePotentiometer(millis(),0);  //the "0" is not relevant here.
