View Full Version : Solved Push Button timer coundown need help

01-08-2012, 10:48 PM
I want to do a sort of timer countdown
It's like
if I press 0 between the 6 second countdown, everything stops
Else after 6 (while runnning the sound) it opens the door

This is my program, (what I have done until now)


OR, it is impossible?

Thank you

Sorry for my bad english

01-08-2012, 11:17 PM
Take a look at loops and testing the button each time through the loop.

Chris Savage
01-09-2012, 06:05 PM
Currently your program doesn't give enough time to press the button before it starts playing the tones. Franklin is correct in that you will need a loop. However the BASIC Stamp Microcontroller is single tasking and can only do one thing at a time, so in your loop you have to be sure you're not doing anything that might cause the button press to be missed. Currently the tone is being played for 1/4 of a second which may also cause the button press to be missed. You may want to reduce the amount of time it plays for and play multiple short bursts within the loop while testing the button. The number of iterations of the loop will have to be determined imperically or calculated by the time of the instructions if you want to get as cloe to 6 seconds as possible.

01-09-2012, 07:49 PM
OK, I'll fix that problem then I'll post a new post trying to solve this problem.
thank you

01-09-2012, 11:50 PM
I figured out somtething else that works (:lol: + it's incredibly easy:thumb:)
Here is the program


Thank you everyone for your help