Hello everyone!! Welcome to this post on Arduino LED Projects!!
Need a short introduction to what the Arduino is then click on LINK
Check out the breadboard intro right HERE
Demo:
So yet another super simple project! Here’s what it looks like:
Things Required:
- Arduino UNO
- Breadboard
- Jumper Wires
- Push Button
- LED
- 220 ohm resistor
- 10k ohm resistor
- Arduino IDE on computer
Functions used:
- digitalWrite()
- digitalRead()
- pinMode()
Reference Material:
I referred to this (LINK) video to build this project.
Code:
int ledstate=0;
int led=7;
int buttonpin=8;
int buttonnew;
int buttonold=1;
int dt=100;
void setup() {
// put your setup code here, to run once:
pinMode(led, OUTPUT);
pinMode(buttonpin, INPUT);
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
buttonnew=digitalRead(buttonpin);
if(buttonold==0 && buttonnew==1){
if(ledstate==0){
digitalWrite(led, HIGH);
ledstate=1;
} else {
digitalWrite(led, LOW);
ledstate=0;
}
}
buttonold=buttonnew;
delay(dt);
}
Stay Tuned for upcoming posts on Arduino Projects! We’re on the basic newbie projects right now and slowly, gradually move on to those cool, ultra techy projects!! Want to be the first to know when a new and amazing post comes up?? Then feel free to subscribe!
Happy Learning!!
