Skip to content

This project demonstrates how to control an LED using a button with an Arduino Uno R3. The LED turns ON when the button is pressed and OFF when released. It uses the INPUT_PULLUP feature to simplify the wiring by eliminating the need for an external pull-up resistor.

Notifications You must be signed in to change notification settings

ZaGrace/Button-LED-Control-Arduino-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Button-LED-Control-OnPressed

Overview

This Arduino project controls an LED using a push button.
The LED turns ON when the button is pressed and OFF when released.
It uses the INPUT_PULLUP configuration to simplify wiring without requiring an external pull-up resistor.


Components Used

  • Arduino Uno R3 or compatible board
  • Push button switch (4-pin)
  • LED
  • Resistor (220Ω) for LED protection
  • Breadboard and Jumper Wires

Wiring

image
  • Button Pin 1GND
  • Button Pin 2Pin 8 (Digital Input)
  • LED Anode (long leg)Pin 9 (Digital Output)
  • LED Cathode (short leg)GND via 220Ω resistor

How It Works

  1. The button is configured with an INPUT_PULLUP resistor, making its default state HIGH when not pressed.
  2. Pressing the button connects it to GND, changing its state to LOW.
  3. The LED turns ON when the button state is LOW and OFF when the button is released.

Code

See the (https://github.com/ZaGrace/Button-LED-Control-Arduino-/blob/main/Button_LED_Control_OnPressed.ino) for the complete code.


License

This project is licensed under the MIT License.

About

This project demonstrates how to control an LED using a button with an Arduino Uno R3. The LED turns ON when the button is pressed and OFF when released. It uses the INPUT_PULLUP feature to simplify the wiring by eliminating the need for an external pull-up resistor.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages