Shop OBEX P1 Docs P2 Docs Learn Events
stupid question #1024 — Parallax Forums

stupid question #1024

ArchiverArchiver Posts: 46,084
edited 2000-04-14 15:23 in General Discussion
im looking at bs1 application dice.bas. my bs2 doesnt like "if pin7
=
1 then Roll". How do you read the pin statis on the bs2? Bill

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2000-04-14 14:04
    Try:

    if in7=1 then Roll

    Regards,

    Al Williams
    AWC
    * Expand your Stamp's I/O with a PAK-III or PAK-IV:
    http://www.al-williams.com/awce/pak3.htm


    >
    Original Message
    > From: wtomlinson@e... [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=BAavUa-yWWv1HD_NN3FygC38JmZ6FVaTGlRFrAAAc5v2SOpKoFbZNXZh2JikIKJvqSC7MUu3gE3iI7h9mq-s4g]wtomlinson@e...[/url
    > Sent: Friday, April 14, 2000 5:40 AM
    > To: basicstamps@egroups.com
    > Subject: [noparse][[/noparse]basicstamps] stupid question #1024
    >
    >
    > im looking at bs1 application dice.bas. my bs2 doesnt like "if pin7
    > =
    > 1 then Roll". How do you read the pin statis on the bs2? Bill
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2000-04-14 15:23
    Bill-

    Some options:

    IF IN7 = 1 THEN Roll

    or

    IF IN7 THEN Roll

    or

    widget_active VAR IN7
    ...
    IF widget_active THEN Roll

    It's helpful to think of the I/O pins as variables which may be
    addressed as bits (e.g. IN7), 4-bit nibbles (e.g. INA.LOWNIB), 8-bit
    bytes (e.g. INA), or a 16-bit word (INS). As with any other
    variable, you can assign an alias, such as widget_active, to refer to
    the variable by a useful name of your choice.

    The Stamp's true/false determination is based on the principle that a
    zero value is false and anything else isn't. So if IN7 is high (1),
    it's true for the IF statement's purposes. That's why "IF IN7 THEN
    Roll" and "IF widget_active THEN Roll" work.

    Steve

    On 14 Apr 00 at 10:39, wtomlinson@e... wrote:

    > im looking at bs1 application dice.bas. my bs2 doesnt like "if pin7
    > = 1 then Roll". How do you read the pin statis on the bs2? Bill
Sign In or Register to comment.