为什么Arduino开发环境老师报错 说RGB.h这个类找不到 20C
 #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();
}

1个回答

更新库文件就可以,把 RGB 的库文件复制到Arduino安装目录下的libraries文件夹下

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问