Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Blinking LED In Arduino Mega 2560
WhatsApp
Sr Karthiga
4y
40.7k
0
1
100
Article
blink.rar
Introduction
In this article, I will explain how to blink an LED in
Arduino
Mega 2560.
Parts Of List:
Arduino Mega 2560
LED-3
Bread Board
USB Cable.
LED:
Light Emitting Diode (LED) can emit light.
The LED glows when the voltage is applied
Figure 1:
LED
Connection:
Take three LEDs and fix them in the Bread Board.
First LED connection:
Positive pin = 13;
Negative pin = Gnd.
Second LED connection:
Positive pin = 12;
Negative pin = Gnd.
Third LED connection:
Positive pin = 11;
Negative pin = Gnd.
Programming:
int
led1 = 13;
int
led2 = 12;
int
led3 = 11;
void
setup()
{
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
pinMode(11, OUTPUT);
}
void
loop()
{
digitalWrite(13, HIGH);
// turn the LED on (HIGH is the voltage level)
delay(1000);
// wait for a second
digitalWrite(13, LOW);
// turn the LED off by making the voltage LOW
delay(1000);
// wait for a second
digitalWrite(12, HIGH);
// turn the LED on (HIGH is the voltage level)
delay(1000);
// wait for a second
digitalWrite(12, LOW);
// turn the LED off by making the voltage LOW
delay(1000);
// wait for a second
digitalWrite(11, HIGH);
// turn the LED on (HIGH is the voltage level)
delay(1000);
// wait for a second
digitalWrite(11, LOW);
// turn the LED off by making the voltage LOW
delay(1000);
// wait for a second
}
Explanation:
When the first LED is ON then automatically take the delay time.
And the second LED is ON and finally the third LED is also ON.
It can be repeatedly done.
Output
Read more articles on
Arduino:
Internet of Things (Basics of IoT)
Arduino LCD display
Arduino
Arduino Mega 2560
Blinking
Internet of Things
IOT
LED
Up Next
Ebook Download
View all
Raspberry Pi -Sensorial Symphony of Connectivity
Read by 706 people
Download Now!
Learn
View all
Membership not found