No response turning off a buzzer with a pressure sensor.

I am building an alarmclock, and want to turn off the buzzer when a pressure sensor is no longer experiencing a certain amount of pressure. I have double-checked if the sensor doesn’t work (with the analogread example code), and it is functioning as it should. Since the code is really long this is the parts that has something to do with the alarm and pressure sensor:

 case SHOW_TIME_ALARM_ON:
            if ( trigger == KEYPAD_LEFT ) state = SHOW_ALARM_TIME;
            else if ( trigger == KEYPAD_RIGHT ) { alarm = false; state = SHOW_TIME; }
            else if ( trigger == KEYPAD_SELECT ) state = SET_ALARM_HOUR;
            else if ( trigger == ALARM_TIME_MET ) { analogWrite(BUZZER_PIN, 250); state = BUZZER_ON; }
            break;
            ...
            case BUZZER_ON:
            if ( analogRead(A1) > 150 ) {
              analogWrite(BUZZER_PIN, 0); 
              alarm = false; state = SHOW_TIME; }
            break;

I am getting no error messages, and i tried using variables instead of ‘analogRead(A1)’ and ‘150’. Since the pressure sensor is on a 3.3V pin, the int-values goes between 0 and ~675. Also: The buzzer doesn’t seem to turn on if i put the analogWrite in the BUZZER_ON case. Example:

case BUZZER_ON:
    analogWrite(BUZZER_PIN, 250); 
    if ( analogRead(A1) > 150 ) {
        analogWrite(BUZZER_PIN, 0); 
        alarm = false; state = SHOW_TIME; }
        break;

Any help appreciated! //Xyffaf

alarm_clock.zip (3.35 KB)

Then the problem is not in any of the code that you posted. Please post everything.

Since the code is too long to include in characters, I put it in an attachment.