Help me please, Need to find out how to count down time and show it on the debu
lm0824
Posts: 3
Hi, first off, thanks in advance
I'm making simple game, first i need to know how i can make a timecounter that counts down from 10 to 0 and shows up on the debug screen.
Any help would be greatly appreciated,
Thanks!
I'm making simple game, first i need to know how i can make a timecounter that counts down from 10 to 0 and shows up on the debug screen.
Any help would be greatly appreciated,
Thanks!
Comments
I have a similar situation. This isn't perfect but close enough for what I need.
Thanks
Thanks again
I am using· your elegant countdown code to make a remote rocket launcher.· I have added some bells and whistles like a LCD for the control box, audible speaker beeps, led flashing, etc.· The idea is to countdown from 10 to 0 and then using a MOSFET, drive a solenoid that removes the holddowns.· I have the solenoid connected and it is working properly.· The code works fine most of the time but every now and then, when I reset the stamp with the reset button,(I plan to use a power key switch to do this when I get the box built) the countdown progresses a couple of loops then activates the solenoid as if it has not gotten through the loops the first time and had to "finish up".·· Or maybe it is not resetting at the proper place in the program.·· Any ideas?·
It is just now and then that the LCD will display the 10, 9, 8, 7 and then activate the soleniod prematurely when the stamp is reset.· I need this to be dependable and reliable for safety's sake as students will be present during launches and premature release of a pressurized rocket is not desirable.· I suppose that do not understand the nested loop as well as I should.
I will try to attach my code to this post.
I had a power point drawing of the circuit but the attachment manager would not allow that to be attached.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Showing up to school doesn't·mean you are a student any more than crawling up in an oven means that·you are a biscuit.
Post Edited (Cogburn) : 4/17/2007 6:55:03 PM GMT
The code looks good although I would explicitly set pins 0 and 9 to LOW during initialization even though they're set to that by the reset itself.
I suspect you have a problem in the firing switch and, for some reason, it's prematurely activating the whole thing. I'm sure if you comment out the "IF IN1 = 1" statement, this problem will go away.
Do you have a pull-down on the line to the button/switch? If not, that's your problem. You need a resistor on that Stamp lead (I/O pin 1) to ground, perhaps 1K to 4.7K. That would require a current of 1-5ma and would tend to dampen out noise pulses. You could also change the inner loop to require that the button be held for about a second like this (with temp2 a nibble variable initialized to zero after countDown[noparse]:)[/noparse]:
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Showing up to school doesn't·mean you are a student any more than crawling up in an oven means that·you are a biscuit.