Shop OBEX P1 Docs P2 Docs Learn Events
AAUGH!! I cant turn a LED on without HIGH! — Parallax Forums

AAUGH!! I cant turn a LED on without HIGH!

Armored CarsArmored Cars Posts: 172
edited 2004-12-10 19:54 in BASIC Stamp
I have been studying the PBASIC help guide but I cant get any of these to work to turn a LED on.

OUT13=1
PIN13=1
DIR13=1

The only thing that works is
HIGH 13

Please help this is frusterating.

Comments

  • steve_bsteve_b Posts: 1,563
    edited 2004-12-10 19:32
    What version of Stamp/Pbasic are you using?

    Might try p13=1.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·

    Steve
    http://members.rogers.com/steve.brady
    http://www.geocities.com/paulsopenstage

    "Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-12-10 19:41
    Using HIGH 13 is the same as:

    DIR13 = 1 
    OUT13 = 1
    



    You can see that HIGH is a bit more convenient as it makes the pin an output (DIR13 = 1), then sets the output driver high (OUT13 = 1). You need both of these actions to get the LED to light.

    If you name the LED with the PIN definition, you can do this:

    LED PIN 13 
    
    Reset: 
      OUTPUT LED 
    
    Main: 
      LED = 1 
      PAUSE 1000 
      LED = 0 
      PAUSE 1000 
      GOTO Main
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • Armored CarsArmored Cars Posts: 172
    edited 2004-12-10 19:54
    I found the mistake. In the help file under INPUT it says

    Explanation
    There are several ways to make a pin an input. When the BASIC Stamp is reset, all of the pins are inputs. Commands that rely on output pins, like PULSIN and SERIN, automatically change the specified pin to input. Writing 0s to particular bits of the variable Dirs makes the corresponding pins outputs. And then there’s the INPUT command.

    I was writing 0s instead of 1s.
Sign In or Register to comment.