RGB LED EN: 두 판 사이의 차이
잔글 (ArduWiki님이 RGB LED(5mm) 문서를 넘겨주기를 만들지 않고 RGB LED EN 문서로 이동했습니다) |
잔글편집 요약 없음 |
||
| 1번째 줄: | 1번째 줄: | ||
{{#seo:|title= | {{#seo:|title=ArduWiki: Arduino RGB LED Guide|title_mode=append|keywords=Arduino, Information Science, Maker Learning, Performance Evaluation, Ultrasonic Sensor, Arduino Projects, Capstone Projects, Arduino Example Code|description=Introduces how to control RGB LEDs with Arduino (basic information, circuit, example code). Can be used in Information Science and Maker classes.}} | ||
[[File:RGBLED 대표1.jpg|center|class=coders100]] | [[File:RGBLED 대표1.jpg|center|class=coders100]] | ||
This is a 4-pin RGB LED that expresses colors by adjusting the RGB values. | This is a 4-pin RGB LED that expresses colors by adjusting the RGB values. | ||
| 106번째 줄: | 106번째 줄: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
=== | ==='''Execution Result'''=== | ||
<div class="coders70"> | <div class="coders70"> | ||
<youtube> yR3n4U2cAfA </youtube> | <youtube> yR3n4U2cAfA </youtube> | ||
</div> | </div> | ||
2025년 3월 26일 (수) 22:05 기준 최신판

This is a 4-pin RGB LED that expresses colors by adjusting the RGB values.
There are Cathode and Anode versions of the product; this document uses the Cathode version.
Specifications
- Operating Voltage [V]: Red (22.2), Green (33.2), Blue (3~3.2)
- Common Cathode type
Example Hardware Used
- Arduino board
- Jumper cables
- RGB LED
- Three 330-ohm resistors (100-ohm, 220-ohm resistors, etc., can also be used.)
Connection
The long leg is GND, and excluding the long leg, from left to right, it is R, G, B as shown in the image below.

| Arduino | Resistor1 | Resistor2 | Resistor3 | RGB LED |
| GND | GND | |||
| D11 | Connected | |||
| D10 | Connected | |||
| D9 | Connected | |||
| Connected | R | |||
| Connected | G | |||
| Connected | B |

Example Code
This code sequentially lights up six different colors.
#define ledR 11
#define ledG 10
#define ledB 9
void brightness(int r, int g, int b) {
analogWrite(ledR, r);
analogWrite(ledG, g);
analogWrite(ledB, b);
}
void setup() {
brightness(0, 0, 0);
delay(500);
brightness(255, 0, 0);
delay(500);
brightness(0, 255, 0);
delay(500);
brightness(0, 0, 255);
delay(500);
brightness(255, 255, 0);
delay(500);
brightness(255, 0, 255);
delay(500);
brightness(0, 255, 255);
delay(500);
brightness(0, 0, 0);
}
void loop() {
}
Execution Result