アドレス指定可能な LED ストリップのプログラムに取り組んでいます。それは機能しており、この時点でコードを改善しようとしています。3 つの LED ストリップがあり、3 つすべてが必要な機能を作成しました。関数では、更新する必要があるものを指定したいので、属性を使用しましたが、これは機能していないようです。FastLed のドキュメントでこれを見つけることができません。
//Number of leds powered
int led_state_1 = 0;
int led_state_2 = 0;
int led_state_3 = 0;
// This is an array of leds. One item for each led in your strip.
CRGB leds1[NUM_LEDS];
CRGB leds2[NUM_LEDS];
CRGB leds3[NUM_LEDS];
void CheckAndUpdateLed(CRGB LedArray, int led_state){
resetLedStrip(LedArray);
for(int whiteLed = 0; whiteLed < led_state; whiteLed = whiteLed + 1) {
// Turn our current led on to white, then show the leds
LedArray[whiteLed] = CRGB::White;
// Show the leds (only one of which is set to white, from above)
FastLED.show();
}
}
LedArray を leds1 に変更すると、機能しています。関数を CheckAndUpdateLed(leds1, led_state_1); として呼び出しています。