simple counting program
support
Posts: 15
hello all, i'm just trying to write a simple program to count every time a pushbutton is pressed and show the number on a terminal screen, so basically the output would look like:
1
2
3
4
5
6
7
etc..
i'm using the parallax proto board usb, and i know how to do the hardware part of it. any help would be much apreciated thanks.
--Henry--
1
2
3
4
5
6
7
etc..
i'm using the parallax proto board usb, and i know how to do the hardware part of it. any help would be much apreciated thanks.
--Henry--
Comments
There should be tons of threads dealing with buttons. Search for button and maybe debounce.
You know that buttons are bouncing? Bouncing means that when pushed/released the electrical contact is not stable because the mechanics bounces back and forth for a short time. If you don't take this into account in your program, the counter would not increase in single steps but jump over several values with each push.
Counting and sending data to a terminal should not be a big problem, right?!
http://www.parallax.com/Portals/0/Downloads/docs/prod/prop/PELabsFunBook-v1.1.pdf
Your code would then say something like
Go to the following page:
http://forums.parallax.com/showthread.php?89958-Propeller-Education-Kit-Labs-Tools-and-Applications
And look at the two sections under PE Kit Tools: PC Terminal Communication and there is Debug LITE for the Parallax Serial Terminal·. The serial terminal turns your computer into a display that allows you to debug SPIN code. I think the manual to which I linked earlier tells step by step how to set that up. In fact, that manual is a very good way to get started learning SPIN, etc.
I hope that helps get you started.