所以我在Processing中編寫了一個腳本,它可以將任何給定圖像的每個像素的HEX值輸出到數組中。我試圖讓這個FastLED庫讀取數組和我得到這麼多不同的錯誤。我試着將HEX的字符串改爲FF和0x頭的字符串。似乎沒有任何工作。現在它一直說十六進制值沒有在範圍內聲明。如果我將字符串更改爲字符串,我會收到一個函數錯誤,告訴我他們不是叮咬。我在智慧結束。這是代碼。用Arduino在LED矩陣上顯示HEX值數組
#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();
}
}
歡迎來到Stack Overflow。請儘快閱讀[關於]和[問]頁面。通過用C和C++標籤標記您的問題,您正在進入微妙的領域。選擇你想要使用的語言,並堅持使用該標籤 - C或C++,但不能同時使用。適用於一種語言的答案通常不適用於另一種語言。 –
刪除C語言標籤。 C語言不支持模板,例如'cLEDMatrix leds;'。嘗試使用C語言編譯器進行編譯,該語句應該會產生一些錯誤。同樣使用範圍解析運算符'::'。 –
請注意,行char'[] = {{FFCE2131},'顯示多個問題。您有一個一維數組,但雙花括號只能用於更復雜的結構(二維數組或實際的C結構)。值「FFCE2131」是一個不是十六進制數字的標識符。你需要'0xFFCE2131'來使它成爲十六進制。通常不能將4個字節的數據放入單個字節對象中。 –