LED 5mm

아두위키 : Arduwiki
ArduWiki (토론 | 기여)님의 2024년 3월 24일 (일) 10:48 판 (Created page with "{{#seo:|title=아두위키 : 아두이노 LED 가이드|title_mode=append|keywords=아두이노, 정보과학, 메이커학습, 수행평가, LED, 아두이노 작품, 캡스톤작품, 아두이노 예제코드|description=아두이노로 LED를 제어하는 방법(기본정보, 회로, 예제 코드)를 소개합니다. 정보과학과 메이커수업에 활용가능합니다.}} center|class=coders100 Apply a constant voltage to emit l...")
(차이) ← 이전 판 | 최신판 (차이) | 다음 판 → (차이)

Apply a constant voltage to emit light.

The longer leg is the positive (+) terminal and the shorter one is the negative (-) terminal, so caution is needed when connecting.

Be careful not to supply a voltage higher than the maximum voltage of the product.

Specifications

These are the specifications of the LED discussed in the text. Specifications may vary slightly depending on the manufacturer and model.

Color Minimum Voltage[V] Maximum Voltage[V] Standard Current[mA] Maximum Current[mA]
Red 1.8 2.3 20 50
Yellow 2 2.8
Green 3 3.6
Blue 3.4 3.8
White 3.4 4

Required Hardware

  • LED
  • Arduino board
  • Jumper cables

Connection

Connect the longer leg through a resistor to a digital pin, and the shorter leg to the Arduino's GND.

You can connect the long legs together to operate from a single digital pin as shown below, or set different digital pins for each LED if you want them to operate separately.

Component Connection to Arduino Notes
LED(+) Connected to Resistor Resistor limits current to Protect LED
Resistor Connected to D7 Pin Recommended to use a resistor between 220Ω and 330Ω
LED(-) Connected to GND

Example Code

#define led 7 // Use pin 7
#define dly 1000

void setup() {
  pinMode(led, OUTPUT);
}

void loop() { // Code for turning on the LED for 1 second intervals
  digitalWrite(led, HIGH);
  delay(dly);
  digitalWrite(led, LOW);
  delay(dly);
}

Execution Result