Shop OBEX P1 Docs P2 Docs Learn Events
two buttons two relays. — Parallax Forums

two buttons two relays.

emsems Posts: 1
edited 2009-05-08 01:23 in BASIC Stamp
I'm hoping to be able to hit one button, close a relay for 20 seconds and during that time hit the other button and close it's relay for 20 seconds

Any help would be most appreciated.

thanks


DO
DEBUG HOME
DEBUG ? IN3
DEBUG ? IN4

IF (IN3 = 1) AND (IN4 = 1)THEN
HIGH 14
HIGH 15
PAUSE 20000

ELSEIF (IN3 = 1) THEN
HIGH 14
PAUSE 20000

ELSEIF (IN4 = 1)THEN
HIGH 15
PAUSE 20000

ELSE
PAUSE 50

ENDIF

LOW 14
LOW 15

PAUSE 25

LOOP

Comments

  • FranklinFranklin Posts: 4,747
    edited 2009-05-08 01:23
    Your code won't work because the stamp can only do one thing at a time. You could write code that would check the buttons every tenth of a second and do what you need with tenth second resolution.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
Sign In or Register to comment.