Locked out of main body while executing sub routine.
To all,
I am building an alarm clock and I am having a problem where my program gets tied up while it is executing the alarm sub-routine. Simply put, while the alarm is playing its 2 second loop it cannot scan for the button which that shuts it off. The user has to hold down the button, which terminates the alarm sub-routine, for the duration of the 2 second loop in order register the input and therefore to exit the sub-routine.
Is there a way around this with code? If not I am thinking that I will have to use a relay.
Actually now that I think about it my above title is incorrect, my problem is not that I am locked out of the main body it is that I am only able to exit the alarm tone loop at a very specific point, but in any event that is my problem.
Thank you in advance,
Zeus
I am building an alarm clock and I am having a problem where my program gets tied up while it is executing the alarm sub-routine. Simply put, while the alarm is playing its 2 second loop it cannot scan for the button which that shuts it off. The user has to hold down the button, which terminates the alarm sub-routine, for the duration of the 2 second loop in order register the input and therefore to exit the sub-routine.
Is there a way around this with code? If not I am thinking that I will have to use a relay.
Actually now that I think about it my above title is incorrect, my problem is not that I am locked out of the main body it is that I am only able to exit the alarm tone loop at a very specific point, but in any event that is my problem.
Thank you in advance,
Zeus
Comments
Another option would be to use an external (to the Stamp) sound making device that the Stamp can start and stop.
Although my syntax might be a bit off (I haven't done PBASIC in a while) the principle is the same. In your loop test for the button. It shouldn't create much of a delay and it will allow the user to exit at any point.
Yes I though about that but there has to be a more elegant solution. I will give SRLM's solution a try and see what results.
Thanks for both of your suggestions.
Zeus
If you use the normal two second sound code in the place of "{Play sound}" the button still wont be able to interupt the sound.
Okay, I missed that. I will have to look into and see what is possible. Thanks for the help.
Zeus