Shop OBEX P1 Docs P2 Docs Learn Events
RCTIME code problem — Parallax Forums

RCTIME code problem

CarloCarlo Posts: 23
edited 2005-04-22 19:30 in BASIC Stamp
Could someone help me with this cose please. The problem is where I an LED should light when the value for RCTIME is less than 20000. The lead does turn on and off but not when it goes over or under 20000.

thanks
Carlo


This is the code:

RC············· PIN···· 14
result········· VAR···· Word

Main:
· DO
··· HIGH RC···························· ' charge the cap
··· PAUSE 1···························· '·· for 1 ms
··· RCTIME RC, 1, result··············· ' measure RC discharge time
··· DEBUG HOME, DEC result············· ' display value
··· IF (result<20000) THEN
····· HIGH 15
··· ELSE
····· LOW 15
··· ENDIF
··· PAUSE 500
· LOOP
· END

Comments

  • edited 2005-04-22 19:30
    Hello,
    ··········· I believe the error is that the prior values are not being cleared. Try the debug line below.
    ·
    ··· DEBUG CLS,DEC result············· ' display value

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Stephen Swanson

    Technical Support
    Parallax, Inc.
    sswanson@parallax.com

Sign In or Register to comment.