Arduino With Push Button and LED [2023] - Poly Notes Hub
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.
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
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);
}
}
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.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.
Arduino With Push Button and LED [2023] - Poly Notes Hub
Take Your Note
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.
Arduino With Push Button and LED [2023] - Poly Notes Hub
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.
Arduino With Push Button and LED [2023] - Poly Notes Hub
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.