Are you SURE you only want to look at the button when the alarm is sounding?!? You will only be able to set the limit to a value lower than the current limit.
if (flexSensorReading < 100) {
Serial.println("Alarm! Set Angle Exceeded");
digitalWrite(Piezo, HIGH);
if (digitalRead(inPin)) {
// LoggedPosition=flexSensorReading;
}
delay(100);
digitalWrite(Piezo, LOW);
}
Look at the sketch I posted to see one way to correct this programming error.