ต่อ LED ภายนอกอย่างปลอดภัย
เพิ่มตัวต้านทานและทำให้ LED นอกบอร์ดกะพริบ
ต่อ LED ภายนอกอย่างปลอดภัย เป็นบทเรียน Arduino & IoT Academy ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน Arduino & IoT Academy และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส Arduino & IoT Academy มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
Beyond the Onboard LED
The onboard light is handy, but real projects need their own LEDs. Wiring one up takes just a few parts and a little care. 🔧
LEDs Have a Direction
An LED only lets current flow one way. Its long leg is the positive anode, and the short leg is the negative cathode. Orientation matters.
Long Leg to the Pin
Connect the long leg toward your Arduino pin, the source of voltage. The short leg heads toward ground, completing the path for current.
Why You Need a Resistor
A raw pin can shove too much current through an LED and burn it out. A resistor limits that flow so the LED stays bright but safe.
Pick the Right Value
For a 5V pin, a resistor around 220 ohms is a safe, common choice. It gives a clear glow without stressing the LED or the pin.
It Goes In Series
Place the resistor in line with the LED, not beside it. Pin to resistor to LED to ground means every electron passes through the resistor.
Either Side Works
A resistor has no direction, so it can sit before or after the LED. What matters is that it stays in the same series path with it.
Find the Ground Pin
Your Arduino has a pin marked GND. The LED circuit must return there, because current needs a complete loop back to ground to flow.
Reuse Your Blink Code
The wiring changed, not the code. Point pinMode and digitalWrite at the pin you wired, and your familiar blink sketch lights the new LED.
const int ledPin = 9;
pinMode(ledPin, OUTPUT);When It Stays Dark
No light usually means a backwards LED or a loose wire. Flip the LED and recheck each connection to ground before blaming the code.
Never Skip the Resistor
Tempted to wire an LED straight to a pin? Do not. Without a resistor you risk frying the LED and even damaging the Arduino pin.
Quick Check
Why does an external LED need a resistor in series?
Recap
You wired an external LED with the long leg to a pin and a resistor guarding the path to ground. You can now build LEDs into any project. 🎉
คำถามที่พบบ่อย
บทเรียน “ต่อ LED ภายนอกอย่างปลอดภัย” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “ต่อ LED ภายนอกอย่างปลอดภัย” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส Arduino & IoT Academy ให้อัปเกรดเป็น CoddyKit PRO คอร์ส Arduino & IoT Academy มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “ต่อ LED ภายนอกอย่างปลอดภัย”
เพิ่มตัวต้านทานและทำให้ LED นอกบอร์ดกะพริบ คุณปฏิบัติ Arduino & IoT Academy ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน Arduino & IoT Academy หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน Arduino & IoT Academy บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน
บทเรียน “ต่อ LED ภายนอกอย่างปลอดภัย” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน Arduino & IoT Academy นี้ได้ไหม
ได้ บทเรียน Arduino & IoT Academy ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- pinMode และ OUTPUT
- digitalWrite HIGH และ LOW
- delay() และจังหวะการกะพริบ
- ต่อ LED ภายนอกอย่างปลอดภัย