- Lesson 98-1: How to turn ON and OFF and LED with Arduino
- Lesson 98-2: How to turn ON and OFF LED using a push button with Arduino
- Lesson 98-3: How to turn ON/OFF toggle LED using posh button. Push ON, Push OFF using Arduino
- Lesson 98-4: Fade light of LED using Arduino. Control Brightness of Light
- Lesson 98-5: Fade light when push button is pressed using Arduino
- Lesson 98-6: See Saw LED Game with Arduino
- Lesson 98-7: Walking Light using Arduino and 5 LED
- Lesson 98-8: Walking Light with push button and LEDs with Arduino
- Lesson 98-9: LED Voltage Level Meter using Arduino
- Lesson 98-10: Arduino Traffic Light
Lesson 98: Arduino 10 LED Push button Projects, Potentiometer LED Voltmeter and Traffic Light
Lesson 98: Arduino 10 LED Push button Projects, Potentiometer LED Voltmeter and Traffic Light
Please select other codes for this lecture from the links below.
Part 1: Introduction
In this lesson we learn how to use LED and Push button in this 10 LED projects. Wiring diagram is shown, code is fully explained and demonstrated with multiple change of settings for each project. We read potentiometer's voltage and display voltage by turning each LED on to represent voltages. A Simple traffic light project.
This code is part of video lecture. This project 3 code is to turn ON/OFF (toggle) LED using a push button.
- 1:16 LED and resistor calculation
- 05:52 Projec 1 LED ON OFF
- 12:41 Projec 2 LED ON/OFF with push button
- 17:12 Projec 3 LED ON/OFF toggle with push button
- 20:10 Projec 4 Fading light of LED
- 23:17 Projec 5 Fading light of LED using push button
- 27:30 Projec 6 See Saw with LED using Arduino
- 30:44 Projec 7 Walking Light Using Arduino
- 36:38 Projec 8 Walking light with push button using Arduino
- 42:21 Projec 9, 5 LED voltage level meter using Arduino
- 49:21 Projec 10 Arduino Traffic Light
/*
* Arduino Step by Step Course by Robojax
* Lesson 98 https://robojax.com/course1/?vid=lecture98
* Project 3 of 10
*
* LED with Push button- toggle
* This code is turning on an LED when a push button is pressed. Every time the push button is pressed the LED will toggle. Meaning by every press
* it if it is ON, it will turn OFF and if it is OFF, it will turn ON
*
* Watch full details and demonstraiton: https://youtu.be/OSwleCBlkuI
*
* Start a full Arduino Step By Step course: https://youtu.be/-6qSrDUA5a8
*
****** 10 Projects explained in this video
* 1-LED ON OFF
* 2-LED ON/OFF with push button
* 3-LED ON/OFF toggle with push button
* 4-Fading light of LED
* 5-Fading light of LED using push button
* 6-See Saw with LED
* 7-Walking Light
* 8-Walking light with push button
* 9-LED voltage level meter
* 10- Arduino Traffic Light
*
* What pars we need:
* -Of course Arduino board (UNO , Nano, Mega or any)
* -Push button switch
* -LED eitehr 5mm or 3mm
* -200ohm to 1000 ohrm resistor for LED
* -Some dupont wires to connec
* -If don't want to solder, then use breadboard
This video is part of Arduino Step by Step Course which starts here: https://youtu.be/-6qSrDUA5a8
* written by Ahmad Shamshiri on Jan 30, 2022
* in Ajax, Ontario, Canada
* www.Robojax.com
If you found this tutorial helpful, please support me so I can continue creating
content like this. Make a donation using PayPal by credit card https://bit.ly/donate-robojax
* This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.*
* This code has been download from Robojax.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
const int pushButtonPin = 2;//define a pin number for push button
const int LEDPin = 3;//define a pin that is connected to LED
int pushButtonStatus = 0; // push value from pin 2
int lightStatus = 0;//light status
int pushed = 0;//push status
void setup() {
pinMode(pushButtonPin, INPUT_PULLUP);//define a pin for push button switch
pinMode(LEDPin, OUTPUT);//define a pin for LED
digitalWrite(LEDPin, LOW);
Serial.begin(9600);//initialize the serial monitor
Serial.println("Robojax LED with push button");//print this text on Serial Monitor
}
void loop() {
pushButtonStatus = digitalRead(pushButtonPin);
if(pushButtonStatus == HIGH && lightStatus == LOW){
pushed = 1-pushed;//toggle the pushed value
delay(100);//give some time for finger to press
}
lightStatus = pushButtonStatus;
if(pushed == HIGH){
Serial.println("Light ON");
digitalWrite(LEDPin, HIGH); //turn the LED ON
}else{
Serial.println("Light OFF");
digitalWrite(LEDPin, LOW);//turn the LED OFF
}
// Watch full details and demonstraiton: https://youtu.be/7xTHaFdCyaI
}