Start here, Make a project!
This blog shares various useful Projects made by Kuman and Kuman's specially invite writers. If you like, welcome to contribute to us, and get paid.
By Kumantech | 07 July 2017 | 288 Comments

How to use a pixel RGB LED display screen?

Components needed:
1. Kuman Arduino UNO board*1
2. Kuman WS01 RGB LED display screen*1
3. Jumper wire*1



Sample code 1:
#include <Adafruit_NeoPixel.h>

#define PIN 6

Adafruit_NeoPixel strip = Adafruit_NeoPixel(64, PIN, NEO_GRB + NEO_KHZ800);

const uint8_t heart[]={10,11,12,13,17,18,19,20,21,22,24,25,26,27,28,29,
                                30,31,33,34,35,36,37,38,42,43,44,45,51,52};

void setup()
{
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop()
{
  theaterChase(strip.Color(127, 127, 127), 50); // White
  //theaterChase(strip.Color(127,   0,   0), 50); // Red
  //theaterChase(strip.Color(  0,   0, 127), 50); // Blue
}

void theaterChase(uint32_t c, uint8_t wait)
{
  for (int j=0; j<10; j++)
  {  //do 10 cycles of chasing
    for (int q=0; q < 3; q++)
    {
      for (int i=0; i < 30; i++)
      {
        strip.setPixelColor(heart[i], c);    //turn every third pixel on
      }
      strip.show();
     
      delay(wait);
     
      for (int i=0; i < 30; i++)
      {
        strip.setPixelColor(heart[i], 0);        //turn every third pixel off
      }
    }
  }
}

Sample Code 2:
#include <Adafruit_NeoPixel.h>

#define PIN 6

Adafruit_NeoPixel strip = Adafruit_NeoPixel(64, PIN, NEO_GRB + NEO_KHZ800);

const uint8_t chart[5][30]={{9,10,11,12,13,14,17,30,33,34,35,36,37,38,46,49,57,58,59,60,61,62},
                            {9,10,11,12,13,14,17,30,33,34,35,36,37,38,41,54,57,58,59,60,61,62},
                            {11,12,19,20,27,28,35,36,43,44,51,52,59,60,60,60,60,60,60,60,60,60}};

void setup()
{
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}

void loop()
{
  theaterChase(strip.Color(5,0,0 ), 50); // White
 
}

void theaterChase(uint32_t c, uint8_t wait)
{
  for (int j=0; j<3; j++)
  {  //do 10 cycles of chasing
    for (int q=0; q < 30; q++)
    {
      for (int i=0; i < 22; i++)
      {
        strip.setPixelColor(chart[j][i], c);    //turn every third pixel on
      }
      strip.show();
     
      delay(wait);
     
      for (int i=0; i < 22; i++)
      {
        strip.setPixelColor(chart[j][i], 0);        //turn every third pixel off
      }
    }
  }
}


 

Recently Reviews

Read More

Leave a Reply

Your email address will not be published.Required fields are marked. *
Name
E-mail
Content
Verification code
POPULAR BLOG