Shop OBEX P1 Docs P2 Docs Learn Events
buttons... — Parallax Forums

buttons...

Peter J. FischelPeter J. Fischel Posts: 28
edited 2009-02-03 21:59 in Propeller 1
On my Propeller Boe Bot I installed 4 buttons, typical from parallax kits.

I connect one poll of the buttons to the port and the other to the 3.3v supply provided.

What is wierd is that if I get my fingers near any of the buttons, the signal triggers.

This is the code...

repeat
· if ina[noparse][[/noparse]24]
··· outa[noparse][[/noparse]16]~~
··· waitcnt(20000+cnt)
··· outa[noparse][[/noparse]16]~

Port 16 is connected to a tiny speaker typical of parallax kits.
Port 24 is the button.

It acts like I am some sort of antenna. Even if I get close to the buttons it causes that routine to chirp.

any ideas how to stop this effect?

Thanks.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2009-02-03 21:49
    When the button is open, there's nothing connected to the Propeller I/O pin. The logic input is a high impedance, high gain MOSFET and will amplify any signal it sees including the induced AC from the power lines in the building as conducted by your finger and the capacitance between your finger and the I/O pin. When you have a switch input, you need a pullup or pulldown resistor to provide the default voltage for the I/O pin. In your case, with the switch connected to +3.3V, you need a pulldown resistor connected between the I/O pin and ground. Anything from about 1K to about 10K should work and give you a little current through the switch contacts. I tend to use 10K.
  • Peter J. FischelPeter J. Fischel Posts: 28
    edited 2009-02-03 21:59
    Thanks a lot Mike!
Sign In or Register to comment.