Pfeffer 2017-10-20 22:15 采纳率: 50%
浏览 552
已结题

为什么Arduino开发环境老师报错 说RGB.h这个类找不到

 #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条回答

  • 柠檬不咸 2019-12-29 23:42
    关注

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

    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能