COUNT Indefinatly
debug
Posts: 2
Hello everyone, I am working my way through "Whats a Microcontroller" by Andy Lindsay, and I am trying to expand on a few of the projects that i've read. One being the button circuit. Ofcourse I just want to count button presses as it seems to be every newbs first idea; however the COUNT command seems to be limited for what I had in mind, which is to keep counting until my battery dies. for example:
'{$STAMP BS2}
'{$PBASIC 2.5}
total VAR Word
btn PIN 3
COUNT btn, 5000, total
DEBUG ? total
this only last 5 seconds, how could I do it indefinatly, I assumed that looping it would do the trick but when I did that I lost my button presses from the previous loop. At any rate... thanks for checking on my post.
-Jason
'{$STAMP BS2}
'{$PBASIC 2.5}
total VAR Word
btn PIN 3
COUNT btn, 5000, total
DEBUG ? total
this only last 5 seconds, how could I do it indefinatly, I assumed that looping it would do the trick but when I did that I lost my button presses from the previous loop. At any rate... thanks for checking on my post.
-Jason
Comments
I think we have same problem since I am also a newbie.
I alredy got the answer troughthis forum.
please refer to my post http://forums.parallax.com/showthread.php?p=613501
It might help you.
'{$STAMP BS2}
'{$PBASIC 2.5}
total VAR Word
Accum VAR Word
btn PIN 3
DO
COUNT btn, 5000, total
Accum = Accum + total
DEBUG ? total
Debug ? Accum
LOOP
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Martin Hebel
StampPlot - Graphical Data Acquisition and Control
AppBee -·2.4GHz Wireless Adapters & transceivers·for the BASIC Stamp & Other controllers·
-Jason