Shop OBEX P1 Docs P2 Docs Learn Events
Push Button timer coundown need help — Parallax Forums

Push Button timer coundown need help

MunifTheGreatMunifTheGreat Posts: 20
edited 2012-01-09 16:50 in General Discussion
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)

Push Button timer coundown.txt

OR, it is impossible?

Thank you

Munif
_____________________________
Sorry for my bad english

Comments

  • FranklinFranklin Posts: 4,747
    edited 2012-01-08 16:17
    Take a look at loops and testing the button each time through the loop.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2012-01-09 11:05
    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.
  • MunifTheGreatMunifTheGreat Posts: 20
    edited 2012-01-09 12:49
    OK, I'll fix that problem then I'll post a new post trying to solve this problem.
    thank you
  • MunifTheGreatMunifTheGreat Posts: 20
    edited 2012-01-09 16:50
    I figured out somtething else that works (:lol: + it's incredibly easy:thumb:)
    Here is the program

    Push Button timer countdown.txt

    Thank you everyone for your help
Sign In or Register to comment.