Shop OBEX P1 Docs P2 Docs Learn Events
If pin goes high then do this? — Parallax Forums

If pin goes high then do this?

ArchiverArchiver Posts: 46,084
edited 2001-11-18 23:45 in General Discussion
Hello,

Does anybody know how to write an IF..THEN that will watch the state of a
pin. I don't see it in the manual. I don't know how to read just one pin.

Thanks
Kevin

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-11-18 12:08
    For Kevin

    Assuming Pin 0

    if in0 = 0 then stop
    if in0 = 1 then go

    Sid
  • ArchiverArchiver Posts: 46,084
    edited 2001-11-18 12:45
    In a message dated 11/18/01 6:09:35 AM Central Standard Time, Newzed@a...
    writes:


    > Assuming Pin 0
    >
    > if in0 = 0 then stop
    >

    Here's another approach that uses less code:

    BRANCH In0,[noparse][[/noparse]Stop, Go]

    -- Jon Williams
    -- Parallax


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2001-11-18 22:05
    IF IN1 = 1 THEN....


    Original Message

    > Does anybody know how to write an IF..THEN that will watch the state of a
    > pin. I don't see it in the manual. I don't know how to read just one
    pin.
  • ArchiverArchiver Posts: 46,084
    edited 2001-11-18 22:18
    Thanks everybody for the support!

    Kevin

    Original Message
    From: Rodent [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=vlwwaUse4IpHkNz2Tng9PenP4ATVHOrzCxYR_XKS_zDB0d9q5a6csl0VeEoybIinwrm3YU_rCOUNjm4]daweasel@s...[/url
    Sent: Sunday, November 18, 2001 3:06 PM
    To: basicstamps@yahoogroups.com
    Subject: Re: [noparse][[/noparse]basicstamps] IF PIN GOES HIGH THEN DO THIS?


    IF IN1 = 1 THEN....


    Original Message

    > Does anybody know how to write an IF..THEN that will watch the state of a
    > pin. I don't see it in the manual. I don't know how to read just one
    pin.




    To UNSUBSCRIBE, just send mail to:
    basicstamps-unsubscribe@yahoogroups.com
    from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.


    Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2001-11-18 22:35
    If you want to read several pins at once, you could OR a group of pins with
    a variable and branch according to the value of the variable. I use this on
    one of my robots to read all of the line sensors at once -- works very well
    and prevents me from having to check each pin one at a time.

    Buy / beg / borrow / steal the Nuts & Volts of Basic Stamps books -- lots of
    good info you won't find in the Stamp manual or in the online documentation.

    Original Message

    > Thanks everybody for the support!

    > IF IN1 = 1 THEN....

    > > Does anybody know how to write an IF..THEN that will watch the state of
    a
    > > pin. I don't see it in the manual. I don't know how to read just one
    > pin.
  • ArchiverArchiver Posts: 46,084
    edited 2001-11-18 23:18
    In a message dated 11/18/01 4:39:29 PM Central Standard Time,
    daweasel@s... writes:


    > Buy / beg / borrow / steal the Nuts & Volts of Basic Stamps books -- lots of
    >

    Better yet, BUY them from Parallax!!! ;-)

    -- Jon Williams
    -- Parallax
    -- ... and a contributor to the above-mentioned books.


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2001-11-18 23:45
    Thats what I meant.

    Any BS2P package weekend deals coming up? I was thinking about a BS2P40 and
    one of those I2C clock / RAM modules. Might even design and build a real
    circuit board for this robot.

    For anyone interested, Radio Shack has the "Spy Kids" RC mini-van for $10
    off -- now $30. Lots of room internally for robot guts and a sunroof that
    looks like it would be good for an LCD display. The sucker is fast too, and
    has a turbo mode. Unfortunately you pay more for a NiMH battery and charger
    than for the car.

    Original Message

    > > Buy / beg / borrow / steal the Nuts & Volts of Basic Stamps books --
    lots of
    > >
    >
    > Better yet, BUY them from Parallax!!! ;-)
Sign In or Register to comment.