I can't find any tutorials online explaining how to wire and control a 16mm push button like the one in the picture:
Do you have any suggestions as to how use it with an arduino or a raspberry pi?
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It only takes a minute to sign up.
Sign up to join this communityI can't find any tutorials online explaining how to wire and control a 16mm push button like the one in the picture:
Do you have any suggestions as to how use it with an arduino or a raspberry pi?
A pushbutton is a pushbutton. It is a momentary switch. Since it has flexible wires, and needs a place to mount, you should probably wire it using a breadboard.
That pushbutton looks like a panel mount pushbutton. You might want to mount it in a pice of plastic or sheet metal. (Unscrew that nut up by the red part that you press. Measure the outside diameter of the threaded part. Drill a hole ≈1/64" (≈0.4MM) bigger than the switch diameter into the plastic/metal. Insert the pushbutton from underneath the panel. screw the nut back on to secure it. Tighten moderately tight with needle-nose pliers, being careful not to round off the corners of the nut.
To wire it:
Get a breadboard. Run wires from your Arduino to the breadboard.
Wire the pushbutton into the breadboard as well.
There are various libraries that offer switch debouncing, or you can write your own fairly easily.
I suggest using INPUT_PULLUP mode, and wiring your switch between an Arduino digital input and ground. When the switch is open, the input will read HIGH. When you press the the switch, the input will drop to LOW.
If you want to debounce the switch input yourself: When the switch changes state, note the value of millis()
, and ignore any new changes for a brief period (try 20-100 mS).