Basic counting code
Still Learning
Posts: 3
Please, need help or at least a kick in the right direction. I have two books Robotics Experiments and Time'N and Count'N. I want to build a code in BS2 to count and total a input. I have 4 logic circuits built. Two for counting and two for time, as in total time the input is high. Eventually I want to add the time of day the input changed.
Thanks
George
Thanks
George
Comments
Jeff T.
I believe that book is written around the PIC micro. Based on your phone call I would say you basically need a state machine code to detect when the door is open and increment a counter and reset once the door closes. It sounds like you already have debounce circuitry to prevent glitches/noise on the I/O pin for switch bounce?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
Input P0 is for total count (low) door opening in a 24 hours. (one day)
Input P1 is for (differant door), how long the input is high. (hours and minutes, total time) in a day. and maybe time of day the input is low and for how long.
Input P2 is the same as P0, Differant door.
Input P3 is the same as P1, Diffrent door.
Please excuse the terminology, I want to take this slow so I can understand the code.
I hope this makes sense.
Thanks
George
" border="0">
The information you need to provide your program will be 1 input for each door indicating whether it is open or closed and 1 input from the rtcc to allow you to time the open/closed state and or time stamp the collected data. I suggest you start by splitting the project in two (door states and time functions) and get familiar with the Pbasic routines for each piece. When you feel comfortable with the two parts it should be a snap to combine them into one program.
Jeff T.
George