FIXED! (thanks Mike Green and PJ Allen) - Really really strange BASIC STAMP beh
pcprogrammer
Posts: 5
So I recently bought a BS2, and had tons of fun getting it to flash lights and stuff. Then I figured I'd try some input stuff, where lights could flash corresponding to what buttons I pressed. I quickly programmed it. Very easy stuff, I figured. I was wrong, of course.
It seems that the BS2 is emitting a sort of electromagnetic field that extends to about a foot above the button I put in for the input. Whenever I insert my hand into that imaginary bubble, the light goes on. Whenever I take my hand out, the light goes off. I thought that was pretty neat at FIRST, but it isn't very useful. How do I get rid of this weird problem? Is there a diagram and some code somewhere that I can follow to see if it's an issue with how i set it up?
I know the BS2 isn't completely busted, because it still works with just output.
Please help!
Post Edited (pcprogrammer) : 3/16/2008 9:07:27 PM GMT
It seems that the BS2 is emitting a sort of electromagnetic field that extends to about a foot above the button I put in for the input. Whenever I insert my hand into that imaginary bubble, the light goes on. Whenever I take my hand out, the light goes off. I thought that was pretty neat at FIRST, but it isn't very useful. How do I get rid of this weird problem? Is there a diagram and some code somewhere that I can follow to see if it's an issue with how i set it up?
I know the BS2 isn't completely busted, because it still works with just output.
Please help!
Post Edited (pcprogrammer) : 3/16/2008 9:07:27 PM GMT
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
would also help.
Do you have a pull up or pull down resistor on that pin?
If not, then that could be the problem.
phil
edit: my pushbutton looks exactly like this one:
http://www.starshipmodeler.com/tech/bw_base/29PushButton.JPG
The junction of the two resistors should go to one terminal and the +V (Vdd) wire should go to the other.
http://www.parallax.com/tabid/535/Default.aspx
Post Edit -- Link added
Post Edited (PJ Allen) : 3/16/2008 5:36:16 PM GMT
Here's how i have mine set up:
(click for larger image)
As well, here's my code (copied from the book):
If you have one, try a capacitor (0.1 uF or so, not super-critical this) across the 10K (one lead to pin 3 and the other to GND.)
The switch should go to +5V (Vdd), your drawing shows it connected to the battery's +.
Also, you should never attach logic elements (like the pushbutton and 220 ohm resistor) to anything other than a 5V regulated supply. The 220 ohm resistor will protect the Stamp pin from destruction, but it's still not good to do. If your "green rectangle" is a 24 pin Stamp module, then use the Vdd (+5V) pin which is the +5V output of the module's regulator. The 9V battery gets connected to Vin while the pushbutton gets connected to the Vdd pin.
edit: I did not see Mike Green's post until after I posted the above. Sorry! Mike, you and I must have posted at the same time!
Post Edited (pcprogrammer) : 3/16/2008 8:53:46 PM GMT
[noparse]:)[/noparse]
I hope the switch isn’t still connected to the 9V line on your board. That will damage the I/O pin of the BASIC Stamp over time. In the diagram you posted that is what you were doing.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support