         reconfiguration(); //Start reconfiguration code
       }
       else if (input == '1') { //alarm has been rung
-        speaker();
+        speaker(alarmTone, sizeof(alarmTone));
       }
 
     }

    opMode = alarm;
    blinkRate = alarmBlinkRate;
  }

  //Setup Bluetooth/serial
  //Even though they might not be used (based on mode), activate them anyways so that the

      blinkRate = 0;
    }
  }
  
  //oscillate light
  if (millis() - time >= blinkRate) {
    statePin = !statePin;
    digitalWrite(ledPin, statePin);
    time = millis();
  }
}

void waterReadings() {
  static bool noticed = false; //has it been noticed that a high reading was made recently?
  static unsigned long timeNoticed = 0; //time the initial high reading was noticed
  static unsigned int timeSinceLastHigh = 0; //time since the last high reading
  static bool activated = false; //has the high readings been around long enough that it warranted an alarm
  static unsigned long lastSignal = 0; //time the last warning signal was sent
  
  // if a water reading is made
  if (digitalRead (sensorPin) == LOW) {
    timeSinceLastHigh = millis(); //a high water reading was made, reset the counter
    
    //if there has been one seen previously
    if (noticed) {
      
      //and it's been around for a while without getting turned off, activate
      if (millis() - timeNoticed >= delayTillAlarm && activated == false) {
        bluetooth.write('1');
        activated = true;
        lastSignal = millis();
      }
      
      //if the alarm has already been activated, wait for the first alarm to play so you don't flood the alarm beacon
      if (activated && millis() - lastSignal >= 1200) {
        bluetooth.write('1');
        lastSignal = millis();
      }
      
    }
    else { //this is the first time it's been seen, make note of it
      noticed = true;
      timeNoticed = millis();
    }
    
  }
  else { //there is no more high water readings
    
    //if the high water readings have been away for a while, kill the alarm
    if (noticed && millis() - timeSinceLastHigh > timeTillOff) {
      noticed = false;
      activated = false;
    }
    
  }
}

