Arduino with Push Button and LED | Circuit Diagram | Code [2023]

In this notes, Poly Notes Hub discuss about a topic Called โ€œArduino with Push Button and LEDโ€œ. About the components, circuit diagram, and Code.

Author Name: Arun Paul.

Introduction

Arduino is now well-known in the exciting world of DIY projects and electronics. With the help of this open-source microcontroller platform, hobbyists can build a variety of cutting-edge devices. This post will discuss the simple yet fascinating Arduino project of using a push button to drive an LED. Weโ€™ll take you step-by-step through the procedure, making it approachable for novices and entertaining for more seasoned enthusiasts.

Arduino with Push Button and LED

In this note, weโ€™ve taken a step-by-step journey into the world of Arduino, exploring how to control an LED with a push button. This project is an excellent starting point for anyone interested in electronics and programming. It demonstrates the fundamental concepts of input and output in a fun and interactive way.

What We Need

The components that are required to make this project

  • Arduino Board
  • One LED
  • One 100 ohm Resistor
  • One Push Button
  • Jumper Wires
  • Breadboard
  • USB cable

Circuit Connection

Arduino with Push Button and LED
Arduino with Push Button and LED

Code

This is the code for Arduino with Push Button and LED.

// constants won't change. They're used here to set pin numbers:
const int buttonPin = 13;  // the number of the pushbutton pin
const int ledPin = 9;    // the number of the LED pin

// variables will change:
int buttonState = 0;  // variable for reading the pushbutton status

void setup() {
  // initialize the LED pin as an output:
  pinMode(ledPin, OUTPUT);
  // initialize the pushbutton pin as an input:
  pinMode(buttonPin, INPUT);
}

void loop() {
  // read the state of the pushbutton value:
  buttonState = digitalRead(buttonPin);

  // check if the pushbutton is pressed. If it is, the buttonState is HIGH:
  if (buttonState == HIGH) {
    // turn LED on:
    digitalWrite(ledPin, HIGH);
  } else {
    // turn LED off:
    digitalWrite(ledPin, LOW);
  }
}

Conclusion | Diploma Engineering Notes | Poly Notes Hub

In this note, we are discussing a topic called โ€œArduino With Push Button and LEDโ€œ. Our Poly Notes Hub provides syllabus-wise notes for polytechnic or diploma engineering students of streams like Electrical Engineering, Electronics Engineering, Electrical and Electronics Engineering, Electronics & Instrumentation Engineering, and Computer Science & Technology. Our website is updating day by day so keep in touch with us for new and syllabus-wise notes and topic which helps you all to do any task regarding diploma engineering.

Share To:

Leave a Reply

Your email address will not be published. Required fields are marked *