กลับไปหน้ารวมไฟล์
make-a-simple-led-flash-6bb3df-en.md

Project Basics

The Make a Simple LED Flash project is the official "Hello, World!" for the Arduino platform. It focuses on the fundamental link between hardware and software, teaching how a line of code can physically manifest as a blinking light.

Hardware Circuit

The circuit is intentionally kept small and easy to understand:

  • LED Anode: Connected to a Digital Pin (usually Pin 13).
  • LED Cathode: Connected to the Arduino's Ground (GND) pin.
  • Resistor: A 220-ohm resistor is placed in series with the LED to limit the current, preventing damage to the LED and the Arduino pin.

Logic Flow: HIGH and LOW

The Arduino is programmed with two states:

  • HIGH: Sends 5V to the pin, lighting the LED.
  • LOW: Sends 0V to the pin, turning the LED off.

By combining these states with the delay() function, we create the recognizable blinking effect:

void loop() {
  digitalWrite(13, HIGH);
  delay(1000); // 1-second delay
  digitalWrite(13, LOW);
  delay(1000);
}

Key Learnings

  • void setup(): Used to tell the Arduino that Pin 13 is an OUTPUT.
  • void loop(): Used to contain the logic that will run continuously until power is removed.
  • Timing: By decreasing the delay values, you can make the LED flash very rapidly or very slowly.

Next Steps

Once you have the LED flashing, you can try:

  • Adding More LEDs: Connect more LEDs to different pins and make them blink in different patterns.
  • Using PWM: Use the analogWrite() command on PWM pins to make the LED smoothly fade in and out instead of flashing.
  • Adding a Sensor: Use a button or a light sensor to trigger the blinking.

This simple project is the first step toward building more complex gadgets and robots.

ข้อมูล Frontmatter ดั้งเดิม

title: "Make a simple LED flash!"
description: "Simple LED blink/flash."
author: "shassandanish1"
category: "Lights & LEDs"
tags:
  - "blink"
  - "led"
  - "arduino"
views: 3154
likes: 0
price: 435
difficulty: "Easy"
components:
  - "1x LED (generic)"
  - "1x Resistor 220 ohm"
  - "1x Arduino UNO"
  - "10x Jumper wires (generic)"
tools: []
apps:
  - "1x Arduino IDE"
downloadableFiles: []
documentationLinks: []
passwordHash: "..."
encryptedPayload: "..."
seoDescription: "Simple and easy project to make an LED flash and blink with an Arduino."
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/make-a-simple-led-flash-6bb3df_cover.jpg"
lang: "en"