For the life of me I can't get this to go together, any help would be appreciated. One very important note, the below case statement can not block the user from pressing other keys on the keyboard and and being able to manipulate their functions (e.g. press R increases temperature by 1)
User presses 'z', this triggers the "silence" mode of my alarm. The looping sound I have in my program stops (that works). Then what I need from this case statement is to:
1: start a timer, so that if the user does not press 'z' again within 5 seconds it will automatically break out of the 'silence' condition and start the looping sound again
2: the user can manually pause the silence condition, by pressing 'z' before the 5 seconds is up.
Here's what I have, and the functions below that are called
Code:
case 'Z':
case 'z':
time(&timeOfMute);
if(isSilenceValid() == TRUE)
{
if((currentTime - timeOfMute) >= 1)
{
setSilencedState(FALSE);
printf("this works");
break;
}
else
setSilencedState(FALSE);
}
else setSilencedState(TRUE);
break;
here are the two functions called above
Code:
char isSilenceValid(){
return silenceIsValid;
}
Code:
char isAverageValid(){
return averageIsValid;
}