Introduction to Arduino
Let’s start by understanding what Arduino is and what it can do for you as a beginner in electronics.

Installing the Arduino IDE
Before you can start programming Arduino, you need to install the Arduino IDE — the official development environment.

Blink: Your First Arduino Project
Let's build your first real Arduino project — make an LED blink!

Understanding Arduino Code Structure
Learn how Arduino code is structured and how setup() and loop() work together.

Working with Digital Output
Learn how to control components like LEDs, buzzers, and relays using digital pins.

Working with Digital Input
Learn how to use buttons and switches with Arduino and respond to user input.

Working with Analog Input
Learn how to read variable values from sensors using analog pins.

Working with Analog Output (PWM)
Use analogWrite() to control brightness, speed, and more with Pulse Width Modulation.

Final Assessment & Certificate
Take this final quiz to test your knowledge. Score 71% or more to earn your certificate!

Reading a Button and Controlling an LED
About Lesson

Now let’s combine a digital input (button) and a digital output (LED).
When the button is pressed — the LED turns ON.
When it’s released — the LED turns OFF.

🧠 Code Example:

void setup() {
pinMode(2, OUTPUT); // LED on pin 2
pinMode(4, INPUT); // Button on pin 4
}

void loop() {
int buttonState = digitalRead(4);

if (buttonState == HIGH) {
digitalWrite(2, HIGH); // Turn LED ON
} else {
digitalWrite(2, LOW); // Turn LED OFF
}
}

💡 What’s happening:
– pinMode(2, OUTPUT) — sets the LED pin
– pinMode(4, INPUT) — sets the button pin
– digitalRead(4) — checks if the button is pressed
– if…else — controls the LED based on button state

✅ Try This:
– Change the LED pin
– Add a second button
– Make the LED blink **only** when the button is pressed

🎉 You’ve just created a real-world input/output system!

Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare