Hackster is hosting Impact Spotlights: Industrial Automation. Watch the stream live on Thursday!Hackster is hosting Impact Spotlights: Industrial Automation. Stream on Thursday!
Khaled Md Saifullah
Published © MIT

Arduino Basic Project-#3

This project is all about the fade in and fade out the led light with Arduino UNO.

BeginnerFull instructions provided30 minutes227
Arduino Basic Project-#3

Things used in this project

Hardware components

Arduino UNO
Arduino UNO
×1
Breadboard (generic)
Breadboard (generic)
×1
5 mm LED: Red
5 mm LED: Red
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Custom parts and enclosures

Arduino-Basic-Project-#3 Fritzing File

Schematics

Arduino-Basic-Project-#3 - Circuit Diagram

Code

Arduino-Basic-Project-#3 - Code

Arduino
// Date: 15/11/21
// Name: Khaled Saifullah
// @kastTech
// Dhaka,Bangladesh

int led = 10;
int brightness = 255;
int fadeAmount = 2;
void setup() {
 pinMode(led, OUTPUT);
 Serial.begin(9600);
}
void loop() {
 analogWrite(10, brightness);
 delay(10);
 brightness = brightness + fadeAmount;
 Serial.println(brightness);
 Serial.println(fadeAmount);
 if((brightness == 0) || (brightness == 255))
 {
   fadeAmount = -fadeAmount;
   Serial.println(fadeAmount);
 }
}

Credits

Khaled Md Saifullah
18 projects • 44 followers
🦸Tech Enthusiast 👨🏾‍💻Programmer 📳IoT Specialist
Contact

Comments

Please log in or sign up to comment.