In this experiment, we will learn how to turn a single LED on and off through the use of an I/O port and button switch. The "I/O port" refers to the INPUT and OUTPUT port. We will use the input function of the Uno I/O port to read the output of an external device. Since the Uno board itself has a LED (connected to Pin 13), we will use the LED to accomplish this experiment for convenience.


 -1 Uno board
- 1 USB cable
- 1 Button
- 1 Resistor (10KΩ)
- Jumper wires
- 1 Breadboard 


Buttons are commonly used components, every circuit contains one at least, they are used to control electronic devices. They are usually used as switches to connect or disconnect electronic components or electronic circuits. Although buttons come in a variety of sizes and shapes, the one used in this experiment will be a 6mm mini-button as shown in the following pictures. Pins pointed out by the arrows of same color are internally connected.

 button size

Fig :6mm mini push button

When the button is pressed, the pins pointed by the blue arrows will internally connect to the pins pointed by the red arrows.

Generally, the button switch is directly connected in an LED circuit in order to turn the LED on or off. This connection is relatively simple. However, sometimes the LED will light up automatically without pressing the button, which is caused by various interferences. In order to avoid these interferences, we will connect a pull-down resistor, that is, connect a 10KΩ resistor between the button port and the GND.

The function of the pull-down resistor is to consume these interferences as long as it remains connected to the GND and the button is off.

This circuit connection is widely used in numerous circuits and electronic devices. For example, if you press any button on your mobile phone, the backlight will light up.

 Experimental Procedures

 Step 1: Connect circuit as shown in the following diagram:

 button connection

Fig 2: button connection

Be aware that we have connected the input only, since the LED is on-board connected, it is connected to Pin 13, the LED is indicated by latter L on the board, the power is supplied to the button from the +5V pin on the Uno board, so no need to supply the circuit with external source, the board gets its power from the USB cable.

The corresponding schematic diagram is as follows: (the schematic is generated by EAGLE)

 circuit schematic

Fig 3: Schematic for button connection

Step 2: Program the Arduino (download program from documents)
Step 3: Compile the program.
Step 4: Burn the program into Uno board.

If you press the button, the LED on the Uno board will light up.

 Experiment Summary

Buttons are a very simple, very practical technology and it is surprisingly easy to master. If you feel as though you're struggling, check out our video tutorials on or ask us questions on our forum.


1-Arduino progrme (code)
2-Eagle file