Neopixel Ring 24-LED(WS2812): 두 판 사이의 차이
(Created page with "{{#seo:|title=아두위키 : 아두이노 네오픽셀 가이드|title_mode=append|keywords=아두이노, 정보과학, 메이커학습, 수행평가, 네오픽셀, 아두이노 작품, 캡스톤작품, 아두이노 예제코드|description=아두이노로 네오픽셀을 제어하는 방법(기본정보, 회로, 예제 코드)을 소개합니다. 정보과학과 메이커수업에 활용가능합니다.}} center|class=coders100...") |
잔글편집 요약 없음 |
||
(같은 사용자의 중간 판 하나는 보이지 않습니다) | |||
35번째 줄: | 35번째 줄: | ||
== '''Library''' == | == '''Library''' == | ||
Adafruit Neopixel library is used. | '''Adafruit Neopixel library''' is used. | ||
Please refer to the [[Arduino Libraries|Arduino library documentation]] for how to use the library. | Please refer to the [[Arduino Libraries|Arduino library documentation]] for how to use the library. | ||
101번째 줄: | 101번째 줄: | ||
=== Execution Result === | === Execution Result === | ||
<div class="coders70"> | |||
<youtube> zAr1dYzFGmQ </youtube> | |||
</div> |
2024년 7월 10일 (수) 14:15 기준 최신판
Neopixel is an LED product from Adafruit that has a WS281x chip built-in.
It comes in various shapes like single, circular, and linear, making it convenient for different applications, with the advantage of easy wiring.
It is commonly used with microcontrollers like Arduino.
Specifications
- Operating Voltage: 5V
- Current per LED: 20mA to 80mA
Example Hardware
- Arduino Board
- 24-bit Neopixel
Connection
This component does not come with pre-attached wires, so you need to solder jumper wires before proceeding.
Arduino | neo pixel |
5V | 5V |
GND | GND |
D7 | DI |
Library
Adafruit Neopixel library is used.
Please refer to the Arduino library documentation for how to use the library.
Example Code
This example sequentially lights up 7 colors.
#include <Adafruit_NeoPixel.h>
#define PIN 7
#define NUMPIXELS 24
#define bright 255
#define dly 50
Adafruit_NeoPixel neo(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
void setup() {
neo.begin();
neo.setBrightness(bright);
neo.clear();
neo.show();
for (int i = 0; i < NUMPIXELS; i++) {
neo.setPixelColor(i, 255, 255, 255);
neo.show();
delay(dly);
}
for (int i = 0; i < NUMPIXELS; i++) {
neo.setPixelColor(i, 255, 0, 0);
neo.show();
delay(dly);
}
for (int i = 0; i < NUMPIXELS; i++) {
neo.setPixelColor(i, 0, 255, 0);
neo.show();
delay(dly);
}
for (int i = 0; i < NUMPIXELS; i++) {
neo.setPixelColor(i, 0, 0, 255);
neo.show();
delay(dly);
}
for (int i = 0; i < NUMPIXELS; i++) {
neo.setPixelColor(i, 255, 255, 0);
neo.show();
delay(dly);
}
for (int i = 0; i < NUMPIXELS; i++) {
neo.setPixelColor(i, 0, 255, 255);
neo.show();
delay(dly);
}
for (int i = 0; i < NUMPIXELS; i++) {
neo.setPixelColor(i, 255, 0, 255);
neo.show();
delay(dly);
}
for (int i = 0; i < NUMPIXELS; i++) {
neo.setPixelColor(i, 0, 0, 0);
}
neo.show();
}
void loop() {
}
Execution Result