for ( int i = 0; i < 16; i++) { leds[i] = ColorFromPalette( targetPalette, i * 16, brightness, NOBLEND); }
ile paleti gösterebildim.
www.tohtml.com kullanıyorum
Bu paletin 16 elemanını da şeritten aşağı kaydırmak istiyorum.
Palettetweak_BestPracticeWorks dosyasından yardım alacağım. Burada paletin her renki birer birer 4’erli led’ler halinde geçiyor.
static uint8_t startIndex = 0; startIndex = startIndex + 1 //eğer bu olmazsa şerit rainbow renklerine bürünüyor ama ilerlemiyor. void FillLEDsFromPaletteColors( uint8_t colorIndex) { uint8_t brightness = 255; for( int i = 0; i < NUM_LEDS; i++) { leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending); colorIndex += 17; //eğer bu olmazsa bütün şerit palet renklerine bürünüyor ve değişiyor. } }
MESELA. Şu şekilde palet bütün şeride yayılıyor.
void loop() { static uint8_t startIndex = 0; // startIndex = startIndex + 1; FillLEDsFromPaletteColors( startIndex); FastLED.show(); FastLED.delay(1000 / UPDATES_PER_SECOND); } void FillLEDsFromPaletteColors( uint8_t colorIndex) { uint8_t brightness = 255; for( int i = 0; i < NUM_LEDS; i++) { leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending); colorIndex += 16; } }
Sırf paleti göstermek istersem şöyle yapıyorum ama sadece ilk 16 led yanıyor
void loop() { static uint8_t startIndex = 0; // startIndex = startIndex + 1; FillLEDsFromPaletteColors( startIndex); FastLED.show(); FastLED.delay(1000 / UPDATES_PER_SECOND); } void FillLEDsFromPaletteColors( uint8_t colorIndex) { uint8_t brightness = 255; for( int i = 0; i < 16; i++) { leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending); colorIndex += 16; } }
leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
böylece
leds[16] ya kadar colorindex+16 şeklinde ledleri dolduruyor.
ANİMASYONu açarsam:
void loop() { static uint8_t startIndex = 0; startIndex = startIndex + 1; FillLEDsFromPaletteColors( startIndex); FastLED.show(); FastLED.delay(1000 / UPDATES_PER_SECOND); } void FillLEDsFromPaletteColors( uint8_t colorIndex) { uint8_t brightness = 255; for( int i = 0; i < 16; i++) { leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending); colorIndex += 16; } }
currentPalette’im 16 LED’lik kısım içinde dönüyor.
BouncingBalls2014 den anladığıma göre geçişte diğerlerini siyah yapmam gerekiyor:
//Then off for the next loop around for (int i = 0 ; i < NUM_BALLS ; i++) { leds[pos[i]] = CRGB::Black;
—
Anlayabilmek için serial dan değerleri Excel e falan dökmeye başladım.
leds[0] | startIndex & Color_Index_Before_Loop | 1 | Coral, |
leds[1] | colorIndex | 17 | Lime, |
leds[2] | colorIndex | 33 | Lime, |
leds[3] | colorIndex | 49 | Lime, |
leds[4] | colorIndex | 65 | Lime, |
leds[5] | colorIndex | 81 | Yellow, |
leds[6] | colorIndex | 97 | Gold, |
leds[7] | colorIndex | 113 | Gold, |
leds[8] | colorIndex | 129 | Yellow, |
leds[9] | colorIndex | 145 | Yellow, |
leds[10] | colorIndex | 161 | Blue, |
leds[11] | colorIndex | 177 | Blue, |
leds[12] | colorIndex | 193 | Blue, |
leds[13] | colorIndex | 209 | DarkSlateGray, |
leds[14] | colorIndex | 225 | Red, |
leds[15] | colorIndex | 241 | Fuchsia |
leds[16] | colorIndex | 1 | Coral, |
.
. . . .
|