Difference between revisions of "Sensor-Module LED Matrix"

From Microduino Wiki
Jump to: navigation, search
(Debugging Program)
Line 36: Line 36:
 
Open IDE, click File→ Examples →Find LED_WS2812
 
Open IDE, click File→ Examples →Find LED_WS2812
 
[[file:ANlib.jpg|600px|center]]
 
[[file:ANlib.jpg|600px|center]]
 +
 +
Change '''#define PIN 6''' to '''#define PIN A0''' as the LED Matrix uses '''A0''' as its default pin.
  
 
<source lang="cpp">
 
<source lang="cpp">

Revision as of 20:06, 21 February 2017

Language: English  • 中文
1Matrixfront.jpg

Microduino-LED Matrix module integrates six WS2812 lights and each light has an IC control chip inside. Six lights adopt single bus control, so you can control each light with one I/O port, which can offer optical source for full-color modules.

Features

  • Adopt six WS2812 lights as the optical source.
  • An analog port can flexibly operate the color of several colored LED lights.
  • Open hardware circuit design and Arduino compatible IDE.
  • With uniform Microduino interface standard and rich peripheral modules, it can flexibly connect with other modules and sensor.
  • 2.54mm (0.1 inch) pin pitch, compatible with bread boards and pegboards.
  • Controlled by Analog port on the back with A0, A1, A2, A3, A6 and A7 for option. A0 is the default pin.
Microduino-RTC-Pinout1

Specification

  • WS2812
    • The tricolor of each pixel can realize brightness display of 256 level and complete 16,777,216 kinds of full color display and no less than 400hz/s scanning frequency.
    • With built-in signal shaping circuit, any pixel receives signal and then outputs after signal shaping, ensuring the circuit wave will not accumulate.
    • Up to 800Kbps data transmission rate.


Main componet

Development

Arduino Library and Support Package

Project

Voice Control Light

Debugging Program

Adopt Adafruit_NeoPixel program example from Microduino IDE. Open IDE, click File→ Examples →Find LED_WS2812

ANlib.jpg

Change #define PIN 6 to #define PIN A0 as the LED Matrix uses A0 as its default pin.

#include <Adafruit_NeoPixel.h> 
#define PIN 6 //Define control pin 
// Parameter 1=Colored LED number in "strip". 
// Para.2=Pin number
// Para.3=Colored LED type. Optional(Select one from the first two or the last two) 
//   NEO_RGB     Pixels are wired for RGB bitstream 
//   NEO_GRB     Pixels are wired for GRB bitstream 
//   NEO_KHZ400  400 KHz bitstream (e.g. FLORA pixels) 
//   NEO_KHZ800  800 KHz bitstream (e.g. High Density LED strip) 
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800); 
void setup() 
{ 
    strip.begin(); 
    strip.show(); //Initialize all light strips are out. 
} 
void loop() 
{ 
    // Method to lighten all lights. 
    colorWipe(strip.Color(255, 0, 0), 50); // Red
    colorWipe(strip.Color(0, 255, 0), 50); // Green 
    colorWipe(strip.Color(0, 0, 255), 50); // Blue 
    rainbow(20); 
    rainbowCycle(20); 
} 
//"c"(color); All lights get lightened in order and it takes a few seconds for the next light to get lightened before the last one. 
void colorWipe(uint32_t c, uint8_t wait) 
{ 
    for(uint16_t i = 0; i < strip.numPixels(); i++)  //Get lightened in order. 
    { 
       strip.setPixelColor(i, c); //The function is used for lightening the "i" light strip with the "c" color. 
        strip.show(); //The function will display the control info. written by the function "setPixelColor". 
                       
        delay(wait); 
    } 
} 

void rainbow(uint8_t wait) //Rainbow display 
{ 
    uint16_t i, j; 
 
    for(j = 0; j < 256; j++)  //225 kinds of color change gradually 
    { 
      for(i = 0; i < strip.numPixels(); i++) //Light up the lights in sequence and wait for a few millisecond 
        { 
            strip.setPixelColor(i, Wheel((i + j) & 255)); 
        } 
        strip.show(); 
        delay(wait); 
    } 
} 
// Different from the function above, it adds rainbow loop. 
void rainbowCycle(uint8_t wait) 
{ 
    uint16_t i, j; 
 
    for(j = 0; j < 256 * 5; j++) //The rainbow circulates for five times. 
    { 
        for(i = 0; i < strip.numPixels(); i++) 
        { 
              //Mathematical transformation added for the loop. 
         strip.setPixelColor(i, Wheel(((i * 256 / strip.numPixels()) + j) & 255));
        } 
        strip.show(); 
        delay(wait); 
    } 
} 
// Enter a number within 0-225 and get the only corresponding color. 
// The color will change from red, green to blue and then red gradually and repeatedly. 
uint32_t Wheel(byte WheelPos) 
{ 
    if(WheelPos < 85) 
    { 
        return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0); 
    } 
    else if(WheelPos < 170) 
    { 
        //Since the WheelPos * 3 will surpass 255 under 85-170, it needs reduce 85 firstly. 
        WheelPos -= 85; 
        return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3); 
    } 
    else 
    { 
        // Since the WheelPos * 3 will surpass 255 under over 170, it needs reduce 170 firstly.
        WheelPos -= 170; 
        return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3); 
    }

Purchase

Pictures

Back
Back