Control a led with a button

 Material required-

  1. Arduino Uno board
  2. jumpers
  3. Led
  4. 1k , 10k resistors(ohm)
  5. Push button switch
  6. 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

Popular posts from this blog

Automatic Water Pumping System

Wireless Communication Between Two Arduino Board Using HC-05 Module

Interfacing "Bluetooth Module" with Arduino Uno