Shop OBEX P1 Docs P2 Docs Learn Events
State Of a Pin — Parallax Forums

State Of a Pin

ArchiverArchiver Posts: 46,084
edited 2003-10-13 05:44 in General Discussion
How do I represent the state of an I/O pin in my programming? I'm hoping to
make a statement along the lines of:
IF "Pin7 is HIGH" Then "Perform Action"


[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-10-13 05:18
    >How do I represent the state of an I/O pin in my programming? I'm hoping to
    >make a statement along the lines of:
    >IF "Pin7 is HIGH" Then "Perform Action"

    Simple!

    IF in7=1 THEN
    ' perform action
    ENDIF

    that is the syntax for PBASIC 2.5.

    You can also give the pin an alias, such as,

    waterHigh pin 7 ' again, "pin" is PBASIC 2.5 syntax

    then the statement becomes,

    IF waterHigh=1 THEN
    ' perform action
    ENDIF
  • ArchiverArchiver Posts: 46,084
    edited 2003-10-13 05:44
    thanks a lot, Tracy! That's just what I was looking for.


    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.