-24%

Grove – Chainable RGB LED 全彩 RGB 可串接式 LED 模組 seeed原廠

NT$162 NT$124 未稅

Grove – Chainable RGB LED是基於P9813全彩LED驅動晶片的RGB LED模塊。它支持串接,最多可同時串接1024個同類模組。

尚有庫存

貨號: 104030006(C1-17) 分類: , , 標籤: , , , ,
  • 商品說明

商品說明

Grove – Chainable RGB LED 全彩 RGB 可串接式 LED 模組

Grove – Chainable RGB LED是基於P9813全彩LED驅動晶片的RGB LED模塊。它支持串接,最多可同時串接1024個同類模組。

 

規格參數

  • 工作電壓: 5V
  • 工作電流: 20mA
  • 通信協議: 串口

Grove - Chainable RGB LED 全彩 RGB 可串接式 LED

應用示例

接下來我們展示這樣一個Demo:多個RGB燈的顏色統一漸變。硬件連接圖: Picture

完成這個Demo,你需要一個或者多個Grove – Chainable RGB LED。注意在級聯RGB模塊時, Grove – Chainable RGB LED的IN接口連接到Grove – Base Shield的D7/D8管腳。它的OUT接口要連接到另一個RGB的IN接口,按照這種方式級聯更多的Grove – Chainable RGB LED模塊。

  • 下載Chainable LED庫文件並安裝到Arduino的Library路徑下。在wiki首頁有一篇關於如何安裝庫文件的課程供參考。
  • 通過路徑:File->Examples->CnainableLED_master 打開例程:CycleThroughColors並上傳,你就可以觀察到Demo效果。
/* 
 * Example of using the ChainableRGB library for controlling a Grove RGB.
 * This code cycles through all the colors in an uniform way. This is accomplished using a HSB color space. 
 */
#include <ChainableLED.h>

#define NUM_LEDS 5

ChainableLED leds(7, 8, NUM_LEDS);

void setup()
{
}

float hue = 0.0;
boolean up = true;

void loop()
{
  for (byte i=0; i<NUM_LEDS; i++)
    leds.setColorHSB(i, hue, 1.0, 0.5);
    
  delay(50);
    
  if (up)
    hue+= 0.025;
  else
    hue-= 0.025;
    
  if (hue>=1.0 && up)
    up = false;
  else if (hue<=0.0 && !up)
    up = true;
}

擴展應用: 基於可鍊式LED庫,我們設計了這個演示:RGB顏色隨Grove測量的溫度而變化 – 溫度。當溫度為25到32時,RGB顏色從綠色變為紅色。測試代碼如下所示。如果您對此感興趣,請這樣做。

    // demo of temperature -> rgbLED
    // temperature form 25 - 32, rgbLed from green -> red
    // Grove-temperature plu to A0
    // LED plug to D7,D8

    #include <Streaming.h>
    #include <ChainableLED.h>

    #define TEMPUP 32
    #define TEMPDOWN 25

    ChainableLED leds(7, 8, 1); // connect to pin7 and pin8 , one led

    int getAnalog() // get value from A0
    {
        int sum = 0;
        for(int i=0; i<32; i++)
        {
            sum += analogRead(A0);
        }

        return sum>>5;
    }

    float getTemp() // get temperature
    {
        float temperature = 0.0;
        float resistance = 0.0;
        int B = 3975; //B value of the thermistor

        int a = getAnalog();

        resistance = (float)(1023-a)*10000/a; //get the resistance of the sensor;
        temperature = 1/(log(resistance/10000)/B+1/298.15)-273.15; //convert to temperature via datasheet ;
        return temperature;
    }

    void ledLight(int dta) // light led
    {

        dta = dta/4; // 0 - 255

        int colorR = dta;
        int colorG = 255-dta;
        int colorB = 0;

        leds.setColorRGB(0, colorR, colorG, colorB);
    }

    void setup()
    {
        Serial.begin(38400);
        cout << "hello world !" << endl;
    }

    void loop()
    {
        float temp = getTemp();
        int nTemp = temp*100;

        nTemp = nTemp > TEMPUP*100 ? TEMPUP*100 : (nTemp < TEMPDOWN*100 ? TEMPDOWN*100 : nTemp);
        nTemp = map(nTemp, TEMPDOWN*100, TEMPUP*100, 0, 1023);
        ledLight(nTemp);
        delay(100);
    }

 

出貨清單

  • Grove – Chainable RGB LED x1
  • Grove連接線 x1

 

Documents

 

=========================================================

 

Grove – Chainable RGB LED

The Grove Chainable RGB LED is based on P9813 chip which is a full-color light source LED driver chip,can provide constant current drive and modulated output of 256 gray.Transmission by wire (DATA and CLK), built-in recycling, can enhance the transmission distance.

Specifications

  • Operating Voltage: 5V
  • Operating Current: 20mA
  • Communication Protocol: Serial