Confusion with IO pins
sensae
Posts: 1
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.
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
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.