     //if the alarm switch is flipped off then turn off the alarm
     alarmOnSwitchVal = (digitalRead(alarmOnPin)==LOW);
     
+     
     if ((hourSwitchVal != prevHourSwitchVal)|| 
         (minSwitchVal != preMinSwitchVal)   || 
         (alarmAMPM != prevAlarmAMPM)        || 
         (!alarmOn && alarmOnSwitchVal) ) // someone deliberately changed a knob position
     {
-        alarmHour = hourSwitchVal + 12 * (byte)alarmAMPM;
+        Serial << alarmOn << alarmOnSwitchVal << ":" << prevHourSwitchVal << preMinSwitchVal << prevAlarmAMPM << "-->";
+        Serial << hourSwitchVal << minSwitchVal << alarmAMPM << endl;
+       alarmHour = hourSwitchVal + 12 * (byte)alarmAMPM;
         alarmMin = minSwitchVal;
         prevHourSwitchVal = hourSwitchVal;
         preMinSwitchVal = minSwitchVal;

    byte	minSwitchVal;
    static byte	prevHourSwitchVal = 255;
    static byte	preMinSwitchVal = 255;
    boolean alarmAMPM;
    static boolean prevAlarmAMPM = false;
    boolean alarmOnSwitchVal;
    
    //read all of the switches positions
    hourSwitchVal	= AlarmHourSwitchValue(); // noon == 0

        tone(speakerPin,NOTE_B4,noteDurationMillis);
        nextNoteTime+=noteDurationMillis+noteGapMillis;        
    }
}
