Skip to main content

Arduino - Button

Arduino - Button

Button And Switch
This article will give an example how to use Arduino board with a switch. The Arduino board reads the digital status of the switch as an input to execute an your functions.

There are two types of switching circuits.

  1. pull-up (Normally the status is '1', If you press the button status is set to '0')
  2. pull-down (Normally the status is '0', If you press the button status is set to '1')
Switching circuit, pull-down

In this article, we will select a pull-up circuit (Normally the status is '1', If you press the button status is set to '0')
Example.
pull-up circuit switch
Example Program
Arduino has special functions for internal pull-up circuits. So we can use only switch. (Must be declared as INPUT_PULLUP)
Internal pull-up circuit switch
Example Program
After uploading the program onto the Arduino board, see the results of running the program from Serial Monitor or Serial Plotter.
 Serial Monitor
Serial Plotter

Comments