monitoring change over time.
press9761
Posts: 6
I am having a hard time here. I am trying to monitor R/C time changes over a period of time and I can't seem to find an command in PBASIC to do so.
this is what I mean.
when R/C time is grater then 500 (lets say)
watch for 2 minutes
if during the 2 minutes it has stayed above 500
do X
I know how to tell the basic stamp2 to check r/c time but not how to monitor in over a certain continues length of time.
anyone know how to do this.
thanks!
this is what I mean.
when R/C time is grater then 500 (lets say)
watch for 2 minutes
if during the 2 minutes it has stayed above 500
do X
I know how to tell the basic stamp2 to check r/c time but not how to monitor in over a certain continues length of time.
anyone know how to do this.
thanks!
Comments
In pseudo-code it might look like this:
/code
'{$PBASIC 2.5}
pause_time var byte
value var byte
under_limit var bit
time con 15 'Set time to 15 seconds (calculate as appropriate)
Start:
under_limit = 0
end_time = 0
pause_time = time
Field_Value:
DO
· RCTIME value
· IF value < 500 then under_limit=1
· pause pause_time
· end_time = end_time + pause_time
Loop until end_time >= 120
IF under-limit = 0 then end_okay
DEBUG "Under limit occurred"
STOP
end_okay:
DEBUG "Limits okay"
END
code/
Unchecked for syntax errors, and before 1st cup of morining java
Regards,
Bruce Bates
Post Edited (Bruce Bates) : 10/28/2005 9:10:17 AM GMT
main:
If rctime1>500 then
charge rctime2 for a 2 minute timer
loop:
if rctime1 < 500 then setunderlimitflag and goto exit
if rctime2 has run out then goto exit
goto loop
exit:
endif
if setunderlimitflag is set then
do something....
else
do something else
endif
goto main