Basic Stamp 2 measuring time
Hey Everybody,
I am a Mechanical Engineering student and have been working on a design project involving a hybrid golf cart. I am using a Basic Stamp 2 module alongwith the carrier board for our charging control circuit. My question involves trying to measure a signal for a certain amount of time.
I am trying to measure a digital input and would like to program the module to activate an IF loop only if it gets a high input for over 5s (or some other value). However, I cannot seem to work out how I would do that. Could someone give me some ideas regarding this? This is my first time ever working with microcontrollers so I am a bit lost really!
Thanks in advance!
-Sam
I am a Mechanical Engineering student and have been working on a design project involving a hybrid golf cart. I am using a Basic Stamp 2 module alongwith the carrier board for our charging control circuit. My question involves trying to measure a signal for a certain amount of time.
I am trying to measure a digital input and would like to program the module to activate an IF loop only if it gets a high input for over 5s (or some other value). However, I cannot seem to work out how I would do that. Could someone give me some ideas regarding this? This is my first time ever working with microcontrollers so I am a bit lost really!
Thanks in advance!
-Sam
Comments
Take a look at the Pulsin and Count commands. Both are used for analyzing input signals.
One or the other should do what you need.
Regards,
Bruce Bates
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->
The first keeps checking for the input. When the input is detected, a second loop is used to start counting some PAUSE value, perhaps 100 msec or 200 msec.
After each increment, go back to the first loop and see if the input is still high. Keep doing this until you've counted a suitable number of 200 msec intervals.
http://forums.parallax.com/forums/default.aspx?f=5&m=94508&g=94637#m94637
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Think outside the BOX!
-Sam