Skip to main content

Posts

Showing posts from August, 2026

Arduino Push Button Toggle: Debouncing a Push Button to Control an LED

Learn how to use a push button as a toggle switch and prevent unwanted multiple inputs using software debouncing. In the previous project, we learned how to use a push button as a digital input to control an LED. The behavior was straightforward: Button pressed → LED ON Button released → LED OFF But what if we want the button to behave like a toggle switch? For example: Press once → LED ON Press again → LED OFF Press again → LED ON This is different from the previous project because the LED should remain in its current state after the button is released. To accomplish this, we need to detect a new button press rather than simply checking whether the button is currently pressed. There is another issue we need to address: mechanical button bounce. In this project, we will learn how to use software debouncing to make the Arduino reliably recognize each physical button press as a single event. What You Will Learn After completing this project, you will understand: What mechanical switch b...

Arduino Push Button LED: Control an LED with a Push Button

Learn how to use a push button as a digital input and control an LED with an Arduino Uno R3. So far, we have used Arduino to control an LED in several different ways. In the previous three projects, we:  turned an LED ON and OFF. used PWM to control its brightness. changed the speed at which the LED blinked. Now, in this fourth project, we are going to introduce something new: an input. We will use a push button to tell the Arduino when to turn an LED ON or OFF. This project introduces the digitalRead() function, which allows the Arduino to read the state of a digital input. Arduino's digitalRead() function returns either HIGH or LOW. What You Will Learn After completing this project, you will understand: What a push button does in an electronic circuit. The difference between an input and an output. How to connect a push button to an Arduino. Why a pull-down resistor is used. How digitalRead() reads a digital input. How if and else statements control program behavior. How a...

Gradually Slowing LED Blink (Tired LED) - Beginner Tutorial

Learn how to make an LED blink rapidly at first and gradually slow down using Arduino. In our first Arduino project, Blink an LED, we learned how to turn an LED ON and OFF using digitalWrite() and control the timing with delay(). In our second project, Fade an LED, we learned how to use PWM to gradually change an LED's brightness. Now, in this project, we are going to use another simple programming concept:  changing the timing of a program while it is running. In this project, the LED will initially blink quickly. After each blink, the waiting time will gradually increase, causing the LED to blink more slowly - as though the LED is becoming tired. What You Will Learn After completing this project, you will understand: How to control an LED's blinking speed. How delay() controls the timing of an Arduino program. How a variable can store a changing delay value. How to increase a variable during program execution. How the same LED circuit can be controlled using different program...

Fade an LED Using PWM - Beginner Tutorial

Learn how to gradually increase and decrease an LED's brightness using an Arduino Uno R3 and Pulse Width Modulation (PWM). In our previous project, we learned how to turn an LED ON and OFF using an Arduino digital output. Now let's take the next step. Instead of simply switching the LED between ON and OFF, we will make it gradually increase and decrease in brightness. To accomplish this, we will use a technique called Pulse Width Modulation (PWM). This project introduces an important Arduino concept that will be useful in many future projects involving LEDs, motors, and other electronic components. What You Will Learn After completing this project, you will understand: What Pulse Width Modulation (PWM) is. Why a PWM-capable pin is required for this project. How analogWrite() controls PWM output. How PWM values from 0 to 255 affect the output. How variables can control LED brightness. How an if statement can reverse the direction of the fade. How to create a continuous fade-in a...

How to Blink an LED with Arduino Uno - Beginner Tutorial

Learn how to make an LED blink using an Arduino Uno R3, a 220 Ω resistor, and a simple Arduino sketch. Hello everyone! If you are familiar with programming, you have probably encountered the classic “Hello, World!” program. It is traditionally one of the first programs used to introduce programming because it demonstrates how a computer can execute a simple instruction. In physical computing, blinking an LED is often considered a similar first step. It introduces the fundamental idea of using software to control physical hardware. In this project, we will connect an external LED to an Arduino Uno R3 and program it to turn ON and OFF repeatedly. By the end of this tutorial, you will understand how to: Connect an LED safely to an Arduino. Use a resistor to limit current. Configure a digital pin as an output. Turn an LED ON and OFF using digitalWrite(). Control timing using delay(). Compile and upload an Arduino sketch. What You Need For this project, you will need: Arduino Uno R3 1 × LED...