본문 바로가기

메이커 Maker

WS2812 아두이노 5050 RGB LED 모듈 12R

반응형




WS2812 아두이노 5050 RGB LED 모듈 12R


WS2812 기반 아두이노 RGB LED 모듈 / 작동 전압 : 5V / LED당 18mA 전류 소모 / 1-wire / -40도 ~ 85도 / 39 x 39 x 3.5mm


외관 이미지






구매 링크 : https://www.devicemart.co.kr/1327852/related/#    3,400원 


사용법 링크 - WS2812 color LED 사용하기  https://arsviator.blogspot.kr/2015/04/ws2812-color-led.html


구매참고 링크 - https://ko.aliexpress.com/item/RGB-LED-12-WS2812-WS2812B-5050-RGB-LED-I2C/32837547125.html


데이터북 참고 


WS2812.pdf



연결은 데이터 입력핀에 적당한 아두이노 핀을 연결한다.





샘플코드 1


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Example programs using the Adafruit Library
 
// Ex1) Lighting the pixels one after the other
 
#include <Adafruit_NeoPixel.h>
 
#define pinPix 12 // WS2812에 연결하는데 사용하는 pin 번호
#define numPix 16 // 링에 연결되어 있는 WS2812 LED 갯수
 
// Parameter 1 = 링에 연결되어 있는 WS2812 LED 갯수
// Parameter 2 = WS2812에 연결하는데 사용하는 pin 번호
// Parameter 3 = pixel type flags, add together as needed:
// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)
// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)
// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)
// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)
 
Adafruit_NeoPixel myLeds = Adafruit_NeoPixel(numPix, pinPix, NEO_GRB + NEO_KHZ800);
 
void setup() {
  myLeds.begin(); // Initialize the NeoPixel array in the Arduino's memory,
  myLeds.show(); // turn all pixels off, and upload to ring or string
}
 
void loop() {
  int pause = 100;
 
  for (int i=0; i<numPix; i++) { 
    myLeds.setPixelColor(i,255,255,255);
    myLeds.show();
    delay(pause);
  }
 
  for (int i=0; i<numPix; i++) {
    myLeds.setPixelColor(i,0,0,0);
    myLeds.show();
    delay(pause);
  }
}
cs



샘플코드 2


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Ex2) Lighting all the pixels simultaneosly
 
#include <Adafruit_NeoPixel.h> // Library for NeoPixels
 
#define pinPix 12 // Pin driving NeoPixel Ring or String
#define numPix 16 // Number of NeoPixels in the Ring or Strip
 
Adafruit_NeoPixel myLeds = Adafruit_NeoPixel(numPix, pinPix, NEO_GRB + NEO_KHZ800);
 
void setup() {
  myLeds.begin(); // Initialize the NeoPixel array in the Arduino's memory,  
  myLeds.show(); // turn all pixels off, and upload to ring or string
}
 
void loop() {
  for (int i=0; i<numPix; i++) {
    myLeds.setPixelColor(i,255,255,255);
  }
  myLeds.show();
  delay(pause);
 
  for (int i=0; i<numPix; i++) {
    myLeds.setPixelColor(i,0,0,0);
  }
  myLeds.show();
  delay(pause);
}
 
cs






반응형

캐어랩 고객 지원

취업, 창업의 막막함, 외주 관리, 제품 부재!

당신의 고민은 무엇입니까? 현실과 동떨어진 교육, 실패만 반복하는 외주 계약, 아이디어는 있지만 구현할 기술이 없는 막막함.

우리는 알고 있습니다. 문제의 원인은 '명확한 학습, 실전 경험과 신뢰할 수 있는 기술력의 부재'에서 시작됩니다.

이제 고민을 멈추고, 캐어랩을 만나세요!

코딩(펌웨어), 전자부품과 디지털 회로설계, PCB 설계 제작, 고객(시장/수출) 발굴과 마케팅 전략으로 당신을 지원합니다.

제품 설계의 고수는 성공이 만든 게 아니라 실패가 만듭니다. 아이디어를 양산 가능한 제품으로!

귀사의 제품을 만드세요. 교육과 개발 실적으로 신뢰할 수 있는 파트너를 확보하세요.

지난 30년 여정, 캐어랩이 얻은 모든 것을 함께 나누고 싶습니다.

카카오 채널 추가하기

카톡 채팅방에서 무엇이든 물어보세요

당신의 성공을 위해 캐어랩과 함께 하세요.

캐어랩 온라인 채널 바로가기

캐어랩