The first time you execute this with the switch closed, you're probably going to burn out the Stamp I/O pin because you would have a short circuit between +5V and ground through the low-side transistor of the I/O pin.
First of all, include a 220 Ohm (or larger) resistor between the I/O pin and the rest of your circuit
How you program things depends on how you want things to behave. I assume that you want this circuit to "remember" that the switch had be closed until you reset the circuit.
To reset the circuit ... either at the start of your program or some time after you've checked the switch setting, do: LOW 0
To check whether the switch has been pressed, you only have to do: IF IN0 THEN GOTO switchPressed
The I/O pin input circuitry already uses the voltage on the input pin to decide whether the pin is a logic 0 or logic 1. Usually that threshold is about 1/2 of the supply voltage.
Thank you! You are right about the intended use. I want the circuit to remember that the switch is pressed until i check it. I was thinking of using RCTIME because I thought the capacitor could discharge faster than IN0 could detect a logic high.
A Stamp I/O pin, when in input mode, has a resistance on the order of megaOhms. A 100uF capacitor will take on the order of minutes to discharge. You might do some experimenting. You'll find that humidity may have a significant effect.
Comments
First of all, include a 220 Ohm (or larger) resistor between the I/O pin and the rest of your circuit
How you program things depends on how you want things to behave. I assume that you want this circuit to "remember" that the switch had be closed until you reset the circuit.
To reset the circuit ... either at the start of your program or some time after you've checked the switch setting, do: LOW 0
To check whether the switch has been pressed, you only have to do: IF IN0 THEN GOTO switchPressed
The I/O pin input circuitry already uses the voltage on the input pin to decide whether the pin is a logic 0 or logic 1. Usually that threshold is about 1/2 of the supply voltage.