Shop OBEX P1 Docs P2 Docs Learn Events
Pin Reset is slow? — Parallax Forums

Pin Reset is slow?

ItsMeNickItsMeNick Posts: 19
edited 2005-11-16 03:23 in BASIC Stamp
Here is my simple code:

Main:
LOW led
IF PIN6 = 0 THEN Main
HIGH led
GOTO Main

When I put +5V to Pin6... the led lights as it should.
However, when i take the +5 away, it take about a second for the led to finally turn off.

What am I doing wrong?
Thanks,
-Nick

Comments

  • JonathanJonathan Posts: 1,023
    edited 2005-11-16 03:01
    Nick,

    Sounds like you need a 10k or so resistor tied to ground. This is ususally called a "pulldown" resistor. It will make the LED turn off correctly by making sure that the pin reads 0 as soon as yu remove Vdd.

    Jonathan

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.madlabs.info - Home of the Hydrogen Fuel Cell Robot
  • ItsMeNickItsMeNick Posts: 19
    edited 2005-11-16 03:07
    Thanks Jon... I'll get to radioshack and give it a try!
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-16 03:23
    Jonathan is right: you need a pull-up or pull-down on any input pin -- if you let it float then the results will be unpredictable. You might want to have a look at our "What's A Microcontroller?" text.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
Sign In or Register to comment.