LED 5mm CN: 두 판 사이의 차이
잔글편집 요약 없음 |
잔글편집 요약 없음 |
||
| 1번째 줄: | 1번째 줄: | ||
{{#seo:|title=Arduino维基:Arduino LED指南|title_mode=append|keywords=Arduino, 信息科学, 创客学习, 性能评估, LED, Arduino项目, 毕业设计项目, Arduino示例代码|description=介绍如何使用Arduino控制LED(基本信息、电路、示例代码)。可用于信息科学和创客课程。}} | {{#seo:|title=Arduino维基:Arduino LED指南|title_mode=append|keywords=Arduino, 信息科学, 创客学习, 性能评估, LED, Arduino项目, 毕业设计项目, Arduino示例代码|description=介绍如何使用Arduino控制LED(基本信息、电路、示例代码)。可用于信息科学和创客课程。}} | ||
[[File:5mmled대표이미지.jpg|center|class=coders100]] | [[File:5mmled대표이미지.jpg|center|class=coders100]] | ||
通过输入恒定电压来发光。 | 通过输入恒定电压来发光。 | ||
2025년 3월 20일 (목) 20:29 기준 최신판

通过输入恒定电压来发光。
长脚为正极(+),短脚为负极(-),连接时需注意。
注意不要提供超过产品最大电压的电压。
规格
这里介绍的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
连接
将长脚通过电阻器连接到数字引脚,将短脚连接到Arduino的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() { // Code for turning on the LED for 1 second intervals
digitalWrite(led, HIGH);
delay(dly);
digitalWrite(led, LOW);
delay(dly);
}
执行结果
