Welcome to this beginner-friendly tutorial by Madras Academy, where you'll learn the fundamental skill of blinking an LED using the Arduino Mega. This "Hello World" of electronics is the perfect first project to kickstart your Arduino journey!
Whether you're completely new to Arduino or just getting started with the Arduino Mega, this tutorial will help you understand the fundamentals of microcontroller programming in a simple, easy-to-follow manner.
Let's make your first Arduino project a success!
Watch the project in action below:
This simplest Arduino project requires just a few basic components to get started:
Essential components:
Component | Quantity | Description |
---|---|---|
Arduino Mega | 1 | Main controller board |
LED | 1 | Any color |
220 ohm Resistor | 1 | Current limiter for LED |
Breadboard | 1 | For building the circuit |
Jumper Wires | 2–3 | For connections |
USB Cable | 1 | To upload code |
// The setup function runs once when you press reset or power the board
void setup() {
// Initialize digital pin 13 as an output
pinMode(13, OUTPUT);
}
// The loop function runs over and over again forever
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
}
Note: This is the built-in example sketch that comes with the Arduino IDE (File > Examples > 01.Basics > Blink).
Now that you've mastered blinking one LED, try these variations:
Continue your learning journey with Madras Academy's beginner courses!