Using a button to control the LED light

This time my project was to configure how to build a button that would turn on and off depending if the user is pushing it or not. While holding the button down the LED should stay on until removing the finger.

For this assignment I used the fallowing components:

  • Arduino UNO and USB
  • Jumper wires
  • LED light
  • Breadboard
  • Button
  • 10k ohm resistor

At first I run the "Hello World" for Arduino and made sure that the LED I was using worked properly (read my previous post).

I attached the button in the middle of the breadboard so the legs were touching the both "sides" of it.

Now I started to connect the jumper wires between the Arduino UNO and the breadboard. In order to get it working like in the sample code (Ardoino > Examples > 02.Digital > Button)
I linked the wires with Arduino's 5V (red wire, positive) and ground (black wire, negative) to the equal holes on the very corner of the breadboard (+ and -). I put the white jumper wire to connect the positive circuit to the button and used 10k ohm resister between the same line with grounds wire (violet) and the other leg of the button.

Finally I connected the LED to digital pin 2 and attached the push button with the green wire to Ardoino's pin 2. I ran the code and tested my device successfully. While pressing the button down I was able to keep the light on but when I took my finger away the light turned off immediately.

Sources -
Based on the prototype course by Tero Karvinen (
and the book - Karvinen 2011: Make Arduino Bots and Gadgets 


Popular Posts