Can somebody help an idiot?
Hello,
Can somebody help me with a problem I'm sure has a super simple solution that this idiot is overlooking...
I'm making a simple security alarm·for my garage, my problem is with switching:
I'm running a wire from the +5 pin on my Stamp D to pin 0, I set pin 0 as input, but whenever I debug it, it works fine as long as the switch is closed... however, the minute the switch opens, debugging it returns 0 or 1 intermittently... Is there something that needs to be installed inline to keep it from wigging out?
Thanks a bunch in advance, your help is greatly appreciated!
-Ben Wampler
Can somebody help me with a problem I'm sure has a super simple solution that this idiot is overlooking...
I'm making a simple security alarm·for my garage, my problem is with switching:
I'm running a wire from the +5 pin on my Stamp D to pin 0, I set pin 0 as input, but whenever I debug it, it works fine as long as the switch is closed... however, the minute the switch opens, debugging it returns 0 or 1 intermittently... Is there something that needs to be installed inline to keep it from wigging out?
Thanks a bunch in advance, your help is greatly appreciated!
-Ben Wampler
Comments
Can somebody help an idiot?:
>
>I'm running a wire from the +5 pin on my Stamp D to pin 0, I set pin
>0 as input, but whenever I debug it, it works fine as long as the
>switch is closed... however, the minute the switch opens, debugging
>it returns 0 or 1 intermittently... Is there something that needs to
>be installed inline to keep it from wigging out?
>
It's called a pull-down resistor (in this case).
Input pins on many (most?) devices will 'float high' when not
connected to anything. This is what is happening (I think) when your
security switch opens. Put a 10k resistor from pin 0 to ground. While
the switch is closed the R will draw negligible current and will
ensure that pin 0 'goes low' when the switch is opened.
(others are welcome to chime in with other suggestions)
It's no accident that stressed Chuck Britton
spelled backwards is desserts. britton@n...