LED 5mm JP: 두 판 사이의 차이

아두위키 : Arduwiki
(새 문서: {{#seo:|title=ArduWiki: Arduino LED Guide|title_mode=append|keywords=Arduino, Information Science, Maker Learning, Performance Evaluation, LED, Arduino Projects, Capstone Projects, Arduino Example Code|description=Introduces how to control LEDs with Arduino (basic information, circuit, example code). Can be used in Information Science and Maker classes.}} center|class=coders100 Apply a constant voltage to emit light. The longer leg is the posi...)
 
잔글편집 요약 없음
 
1번째 줄: 1번째 줄:
{{#seo:|title=ArduWiki: Arduino LED Guide|title_mode=append|keywords=Arduino, Information Science, Maker Learning, Performance Evaluation, LED, Arduino Projects, Capstone Projects, Arduino Example Code|description=Introduces how to control LEDs with Arduino (basic information, circuit, example code). Can be used in Information Science and Maker classes.}}
{{#seo:|title=アルドゥウィキ:アルドゥイーノLEDガイド|title_mode=append|keywords=アルドゥイーノ, 情報科学, メーカー学習, パフォーマンス評価, LED, アルドゥイーノプロジェクト, キャップストーンプロジェクト, アルドゥイーノサンプルコード|description=アルドゥイーノでLEDを制御する方法(基本情報、回路、サンプルコード)を紹介します。情報科学とメーカー授業で活用できます。}}[[File:5mmled대표이미지.jpg|center|class=coders100]]
[[File:5mmled대표이미지.jpg|center|class=coders100]]
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.
 
 
== '''仕様''' ==
ここで説明するLEDの仕様です。メーカーやモデルによって少し異なる場合があります。
{| class="wikitable"
{| class="wikitable"
| colspan="1" rowspan="1" |Color
| colspan="1" rowspan="1" |Color
39번째 줄: 40번째 줄:
|}
|}


== '''Required Hardware''' ==


== '''必要なハードウェア''' ==
* LED
* LED
* Arduino board
* Arduino board
* Jumper cables


* Jumper cables


== '''Connection''' ==
== '''接続''' ==
Connect the longer leg through a resistor to a digital pin, and the shorter leg to the Arduino's GND.
長い足を抵抗器を通じてデジタルピンに接続し、短い足をアルドゥイーノの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.
以下の例のように長い足をまとめて一つのデジタルピンから動作させることもでき、別々に動作させたい場合は各LEDに別々のデジタルピンを設定します。
{| class="wikitable"
{| class="wikitable"
| colspan="1" rowspan="1" |Component
| colspan="1" rowspan="1" |Component
70번째 줄: 70번째 줄:
[[File:Led 회로.png|center|class=coders70]]
[[File:Led 회로.png|center|class=coders70]]


== '''Example Code''' ==
 
== '''サンプルコード''' ==
<syntaxhighlight lang="c++" line="1">
<syntaxhighlight lang="c++" line="1">
#define led 7 // Use pin 7
#define led 7 // Use pin 7
79번째 줄: 80번째 줄:
}
}


void loop() { // Code for turning on the LED for 1 second intervals
void loop() { //1秒間隔でLEDが点滅するコード
   digitalWrite(led, HIGH);
   digitalWrite(led, HIGH);
   delay(dly);
   delay(dly);
88번째 줄: 89번째 줄:
</syntaxhighlight>
</syntaxhighlight>


=== Execution Result ===
 
=== '''実行結果''' ===
[[File:Led 시연.jpg|center|class=coders100]]
[[File:Led 시연.jpg|center|class=coders100]]

2025년 3월 20일 (목) 20:21 기준 최신판

一定の電圧を入力して光を発生させます。

長い足が正極(+)、短い足が負極(-)なので、接続時には注意が必要です。

製品の最大電圧を超えないように注意してください。


仕様

ここで説明するLEDの仕様です。メーカーやモデルによって少し異なる場合があります。

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


必要なハードウェア

  • LED
  • Arduino board
  • Jumper cables


接続

長い足を抵抗器を通じてデジタルピンに接続し、短い足をアルドゥイーノのGNDに接続します。

以下の例のように長い足をまとめて一つのデジタルピンから動作させることもでき、別々に動作させたい場合は各LEDに別々のデジタルピンを設定します。

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


サンプルコード

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

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

void loop() { //1秒間隔でLEDが点滅するコード
  digitalWrite(led, HIGH);
  delay(dly);
  digitalWrite(led, LOW);
  delay(dly);
}


実行結果