所以我在处理中写了一个脚本,可以将任何给定图像的每个像素的十六进制值输出到一个数组中。我试图让这个 FastLED 库读取数组,但我遇到了很多不同的错误。我尝试将 HEX 更改为使用 FF 和 0x 标头的字符串。似乎没有任何效果。现在它一直说十六进制值没有在范围内声明。如果我将十六进制更改为字符串,我会收到一个函数错误,告诉我它们不是刺痛。我束手无策。这是代码。
#include <FastLED.h>
#include <LEDMatrix.h>
#include <string.h>
// Change the next 6 defines to match your matrix type and size
#define LED_PIN 7
#define COLOR_ORDER GRB
#define CHIPSET WS2811
#define MATRIX_WIDTH 32 // Set this negative if physical led 0 is opposite to where you want logical 0
#define MATRIX_HEIGHT 8 // Set this negative if physical led 0 is opposite to where you want logical 0
#define MATRIX_TYPE VERTICAL_ZIGZAG_MATRIX // See top of LEDMatrix.h for matrix wiring types
cLEDMatrix<MATRIX_WIDTH, MATRIX_HEIGHT, MATRIX_TYPE> leds;
char pixs [] = {{FFCE2131},
{FFCE1929},
{FFCE1929},
{FFCE1929},
{FFCE1929},
{FFCE1929},
{FFCE1929},
{FFCE2131},
{FFC50821},
{FFC50821},
{FFC50821},
{FFC50821},
{FFC50821},
{FFC50821},
{FFC50821},
{FFC50821},
{FFCE1929},
{FFC50821},
{FFC50821},
{FFC50821},
{FFC50821},
{FFC50821},
{FFC50821},
{FFCE1929},
{FFCE1929},
{FFC50821},
{FFC50821},
{FFC50821},
{FFC50821},
{FFC50821},
{FFC50821},
{FFCE1929},
{FFCE1929},
{FFC50821},
{FFC50821},
{FFC50821},
{FFC50821},
{FFC50821},
{FFC50821},
{FFCE1929},
{FFCE1929},
{FFC50821},
{FFC50821},
{FFC50821},
{FFC50821},
{FFC50821},
{FFC50821},
{FFCE1929},
{FFCE1929}};
void setup()
{
FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds[0], leds.Size());
FastLED.setBrightness(15);
FastLED.clear(true);
delay(500);
FastLED.clear(true);
Serial.begin(9600);
}
void loop() {
leds(0,0) = 0xCE2131;
leds(31,0) = CRGB::White;
leds(0,7) = CRGB::Green;
leds(31,7) = CRGB::Yellow;
FastLED.show();
delay(2000);
FastLED.clear(true);
delay(1000);
int i;
for ( i = 0; i < length.pixs ; i ++){
leds(0,0) = pixs[i];
FastLED.show();
}
}