Introduction: ARDUINO BUTTON LED
This instructables tutorial shows how to control an LED using a small push-to-on button and an ARDUINO.
Step 1: COMPONENTS REQUIRED
HARDWARE:
- 1 x ARDUINO / GENUINO UNO(I used the R3)
- 1 x BREADBOARD
- 1 x USB A-B CABLE
- 1 x SMALL PSHBUTTON
- 7 x MALE TO MALE JUMPER CABLES
- 1 x 10k ohm RESISTOR
SOFTWARE:
ARDUINO IDE
Step 2: CIRCUIT
CONNECT:
BUTTON TO PIN D-2
GND TO BUTTON VIA 10k RESISTOR
5V TO 5V
Step 3: CODE
WE'LL USE AN INBUILT CODE AGAIN.
FIRST OPEN THE ARDUINO IDE
CLICK ON FILE
CLICK ON EXAMPLES
CLICK ON 2.DIGITAL
SELECT BUTTON
Step 4: HOW IT WORKS
In the code, the LED is defined as pin 13, because the 'L LED' is connected to pin D-13.
When the button is pressed, the 'L LED' is turned on.