กลับไปหน้ารวมไฟล์
led-wave-27b109.md

This is not, a super complicated project and uses no libraries! I would recommend this to any beginner as it is very fun and quick. I recommend that when you do make this project you expand it to as many leds as you can!


🛠️ เจาะลึกเบื้องหลังการทำงาน (Deep Dive / Technical Analysis)

Standard LED Chasers just bounce a light back and forth mechanically. The LED Wave project elevates this by using mathematical trigonometry to dictate brightness, creating incredibly smooth, organic fading animations that perfectly mimic a water wave.

The Math Behind the Flow

To achieve organic fading, you must use Pulse Width Modulation (PWM).

  1. The Array: You line up 6 LEDs exclusively on Arduino PWM pins (e.g., 3, 5, 6, 9, 10, 11).
  2. The Equation: Instead of manually setting the brightness, the code calculates the sin() value of a continuously shifting variable (representing time or phase). float brightness = (sin(phase + LED_Position) + 1) * 127.5;
  3. The Break Down:
    • A standard sine wave swings between -1 and +1.
    • We add +1 so it swings between 0 and 2.
    • We multiply by 127.5 so the final output is a perfect PWM number between 0 and 255!
  4. Phase Shifting: By slightly offsetting the phase for each LED in the array, LED 1 might be at max brightness while LED 2 is at 80% and LED 3 is at 10%. As the phase number linearly increases over time, the "swell" of the wave naturally glides across the breadboard.

Setup Requirements

  • Arduino Uno/Nano: Need 6 actual hardware PWM pins.
  • 6x LEDs and 6x Resistors.
  • Breadboard.
  • (Advanced Upgrade: Use a WS2812B NeoPixel strip to execute this math on 100 LEDs simultaneously!).

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

title: "Led Wave!"
description: "A simple beginner project that explains how leds work, and it can be easily expanded!"
author: "stannano"
category: ""
tags:
  - "easy"
  - "begginer"
  - "led"
  - "simple"
  - "quick"
  - "fun"
views: 15383
likes: 0
price: 99
difficulty: "Easy"
components:
  - "1x Premium Male/Male Jumper Wires, 40 x 3\" (75mm)"
  - "1x Breadboard, 170 Pin"
  - "5x Resistor 10k ohm"
  - "1x Arduino UNO"
  - "5x 5 mm LED: Red"
tools: []
apps:
  - "1x Arduino IDE"
downloadableFiles: []
documentationLinks: []
passwordHash: "4386dc0f978b9f6e787e999d2098b9c006525723cda93b7aee0e0b7c3d8915dc"
encryptedPayload: "U2FsdGVkX18nkJHruTzBfGfn33DYcOT9npNnYyKgmDyQB6arnsi4XzWy1vFhWtJULElIIurXSosYY8+Q/wur9RF2SMdIC+aLRmXYiUrEaFo="
seoDescription: "Learn how Led works with the Led Wave project. A simple beginner-friendly Arduino project that is easy to expand."
videoLinks: []
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/led-wave-27b109_cover.jpg"
lang: "en"