#include <Adafruit_NeoPixel.h>
#include <Adafruit_GFX.h>
#include <Adafruit_NeoMatrix.h>
#include "RGB.h"
#define PIN 13
Adafruit_NeoMatrix matrix = Adafruit_NeoMatrix(6, 10, PIN,
NEO_MATRIX_TOP + NEO_MATRIX_LEFT +
NEO_MATRIX_ROWS + NEO_MATRIX_ZIGYAG,
NEO_GRB + NEO_KHZ800);
//Color(uint8_t r, uint8_t g, uint8_t b);
//matrix.drawPixel(0, 0, matrix.Color(red.r, red.g, red.b));
//matrix.show();
//..................................................................
struct RGB {
byte r = 0;
byte g = 0;
byte b = 0;
};
// Define some colors we'll use frequently
RGB white = { 255, 255, 255 };
RGB red = { 255, 0, 0 };
RGB off = { 0, 0, 0 };
//..............................................................
void setup() {
matrix.begin();
matrix.setBrightness(10);
matrix.setTextColor( matrix.Color(255, 255, 255) );// 设置整个灯的亮度为白色的
matrix.setTextWrap(false);
}
void colorWipe(RGB color, uint8_t wait) { // 一个字节
for(uint16_t row=0; row < 6; row++) { // 两个字节
for(uint16_t column=0; column < 10; column++) {
matrix.drawPixel(column, row, matrix.Color(color.r, color.g, color.b));
matrix.show();
delay(wait);
}
}
}
void drawLogo() {
// This 8x8 array represents the LED matrix pixels.
// A value of 1 means we’ll fade the pixel to white
int logo[6][10] = {
{0,0,0,0,0,0,0,0,0,0},
{0,0,0,0,1,1,0,0,0,0},
{0,0,0,0,1,1,0,0,0,0},
{0,0,0,0,1,1,0,0,0,0},
{0,0,0,0,1,1,0,0,0,0},
{0,0,0,0,0,0,0,0,0,0}
};
for(int row = 0; row < 6; row++) {
for(int column = 0; column < 10; column++) {
if(logo[row][column] == 1) {
fadePixel(column, row, off, red, 1, 0);// 尝试这个
}
}
}
}
void loop()
{
void drawLogo();
}