Working with an LED and a Push Button

This project demonstrates the use of a push button to operate an LED.

Apr 24, 2019

205072 views

21 respects

Components and supplies

1

Breadboard (generic)

2

Resistor 1k ohm

5

Jumper wires (generic)

1

Arduino UNO

1

LED (generic)

Apps and platforms

1

Arduino IDE

Project description

Code

LED ON when button is pressed

arduino

LED is set to ON when the button is pressed.

LED is OFF when button is pressed (Opposite effect)

arduino

LED is OFF when button is pressed (Opposite effect)

Downloadable files

Breadboard Diagram

Make connections as shown in the figure

Breadboard Diagram

Comments

Only logged in users can leave comments

superbruh2023

2 years ago

"Hippity Hoppity Your Code Is Now My Probity

brave-new-world

2 years ago

Thanks for putting this up. Just getting into Arduino and the hardest thing is not writing code, or following diagrams. Amazingly its finding simple things to do to help you learn. You have no idea how many simple projects are actually way too overly complicated i'e 'Starter project: Build Your Own Spaceship'.

Anonymous user

2 years ago

Thanks for putting this up. Just getting into Arduino and the hardest thing is not writing code, or following diagrams. Amazingly its finding simple things to do to help you learn. You have no idea how many simple projects are actually way too overly complicated i'e 'Starter project: Build Your Own Spaceship'.

Anonymous user

3 years ago

no work, do better. Parents must be disappointed.

Anonymous user

3 years ago

This is a total noob question. Why wouldn't the button be in the same circuit? I'm clearly thinking of a switch. Does the button function as a switch? Thanks Dan the noob

angelotulp

2 years ago

Thats also possible, then you can just use the code below and this circuit: https://www.tinkercad.com/things/1qgugA3vZ4O-led-with-pushbutton #define LED 3 void setup() { pinMode(LED, OUTPUT); } void loop() { digitalWrite(LED, HIGH); }

Anonymous user

3 years ago

Great incremental learning project from learning outputs with Blinky project to using a switch to learn input with a push button! Thanks!!

Anonymous user

3 years ago

Does this work with a 830 Tie-points Breadboard? Because when I set it up with it for some reason it wont work, and I don't have any other breadboard.

danger2011

4 years ago

ummm how do it put this it won't work

Anonymous user

6 years ago

No debounce?