Shop OBEX P1 Docs P2 Docs Learn Events
Confusion with IO pins — Parallax Forums

Confusion with IO pins

sensaesensae Posts: 1
edited 2010-09-22 19:10 in BASIC Stamp
Hello,

I'm following along in the "What's a Microcontroller?" book with a HomeWork board and I'm at the step in Chapter 3 where a push button is hooked up to an input pin and is used to light an LED. I made a mistake in my source code, listening on IN1 when I was hooked to IN0. However, my push button still worked about 80% of the time, and only after the board was on for 10 or more seconds did it stop sensing.

My question is, what's going on here?

Source:
' {$STAMP BS2}
' {$PBASIC 2.5}

DO
DEBUG ? IN1
LOOP
END

EDIT: Edited for clarity, fixed part of my own issue halfway through writing this post.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-09-22 19:10
    When an I/O pin is in input mode (the default), it's a very high impedance input and very very sensitive to voltages like those induced in the I/O pin from adjacent conductors, from induction from hand capacitance (bringing your hand nearby), etc.

    Try an experiment and connect a 10K resistor (or something similar in value) between the I/O pin (1) and Vss (or Vdd). You'll see that it stays at 0 (or 1) even if you bring your hand nearby or touch the pin.
Sign In or Register to comment.