Control a led with a button
Material required-:
- Arduino Uno board
- jumpers
- Led
- 1k , 10k resistors(ohm)
- Push button switch
- Breadboard
This is a simple Arduino Uno project basically for beginners ,It's a simple circuit which turns the led on when button is pressed and off when it's released , its fun to operate and also very exciting .
HAPPY LEARNING!
![]() |
| Fig-1 Circuit Diagram |
Arduino code
const int L1 = 13; // led pin
const int buttonPin = 6;// button pin
int buttonState =0; // for reading the push button status
void setup() {
pinMode(L1, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop() {
// put your main code here, to run repeatedly:
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH)
{
digitalWrite(L1,HIGH);
}
else{
digitalWrite(L1,LOW);
}
}
For any queries contact me on-:tombriddle28@gmail.com
YouTube Channel-: Omnific, (SUBSCRIBE) {If this post helps you please do subscribe my
YouTube channel too ,It's only a click for you but it means a lot to me.}

Comments