Shop OBEX P1 Docs P2 Docs Learn Events
RCTIME on the BS2 Board of education question — Parallax Forums

RCTIME on the BS2 Board of education question

firealarmfreakfirealarmfreak Posts: 105
edited 2008-08-04 07:40 in BASIC Stamp
hey i am haveing trouble with my circuit and program for basic stamp 2 on the board of education.

i am trying to make a led turn on when a wire is removed from a switch, using RCTIME.

I was told to use a 10 k ohm end of line resister on my switch, and a 0.1 uf cap between my switch on the board of education and vss.

Heres the code im using:

time1 VAR Word

DO
HIGH 3
RCTIME 3,1, time1
IF time1 = 0 THEN GOTO LED

LED:
DO
HIGH 12
LOOP

'End of Code'

But if i use the code below and replace the 0 with one, and activate the switch, the led turns on. Any ideas?

time1 VAR Word

DO
HIGH 3
RCTIME 3,1, time1
IF time1 = 1 THEN GOTO LED

LED:
DO
HIGH 12
LOOP

'End of Code'

Chris.

Comments

  • FranklinFranklin Posts: 4,747
    edited 2008-08-03 03:02
    RCTIME pin, state, variable

    State is a variable/constant/expression (0 - 1) that specifies the desired state to measure. Once Pin is not in State, the command ends and stores the result in Variable.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • firealarmfreakfirealarmfreak Posts: 105
    edited 2008-08-03 03:03
    uhhh so what is my problem? why is it not working and what can i do to fix it?
  • agfaagfa Posts: 295
    edited 2008-08-03 04:47
    if i understand what you are trying to do, and your hardware is correct, you could write a routine that debugs the value of time1. you should get three ranges of value.
    1. switch open / wire intact
    2. switch closed / wire intact
    3. wire not intact

    this will provide the information you need to create the if/then statements.
  • firealarmfreakfirealarmfreak Posts: 105
    edited 2008-08-04 07:40
    Never Mind. I got it working using RCTIME.

    I found out my circuit was wired wrong.

    Thanks for all the advice anyways,

    Chris.
Sign In or Register to comment.