if (h==8 && m==30 && s==0 && B==1){
do{
tone(sound,330);
}
while(B==1);
You never change B. If b==1 it goes into the loop and stays there while B==1. If B is supposed to be the value read from the switch, the read the value in the loop (ie, set B = digitalRead(yourPin); ).