Switch are standard input to any electronic projects. Tactile switch works well in a PCB also can be used on a solderless breadboard. Switch are normally open or disconnected and when the push button is pressed are momentarily closed. Tactile switch are everywhere and they are especially popular in DIY electronics and microcontroller boards because they are well suited to act as a boot option or reset switch. Particularly, momentary switches are switches that don’t save their state you depress the switch. Below are the illustration that covers the purpose of the switch together with the microcontroller.

Interrupts are very useful feature in the microprocessor. Interrupts allows you to run a program while still being able to react to asynchronous input externally. Example below will demonstrate the uses of interrupt together with denouncing.

Tactile switch / Push Button generates open/close transition when pressed, due to a mechanical issue: these transitions may read a multiple press in a very short time. Without debouncing, pressing the push button once may generate an unpredictable results or noise. As you can see the code below its uses milis() function to keep track the time passed since the push button was pressed.

Required Components

  • Arduino, MEGA, UNO, DUE, NANO, PRO, AVR
  • Push Button Module / Tactile Switch / Push Button / Momentary Push Button
  • 10 k Resistor
  • Jumper Wires
  • Solder-less Bread Board

Wiring Diagram Push Button Manual 

momentary-push-button-interrupt-debounce-arduino

Wiring Diagram using the Push Button Module

37-in-1-sensor-kit-14core-soure-code-wiring-guide-push-button-tactile-switch-stays-on

Source Code / Sketch Code

Source Code  / Sketch Code for Debounce & Interrupt

The code below will demonstration how to use debounce on the Arduino micro-controller using push button. When button press it will stay HIGH State if press again it will stay at LOW State.

 

Working on Debounce / Interrupts on Switch with MCU
Facebooktwittergoogle_plusredditpinterestmail
Tagged on:                     

Leave a Reply

Your email address will not be published. Required fields are marked *