View difference between Paste ID: qiDzzEZm and R5aP24TE
SHOW: | | - or go back to the newest paste.
1
void setup()
2
{
3
  FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
4
5
  pinMode(pm, INPUT);
6
7
  EVERY_N_MILLISECONDS(100)
8
  {
9
    if (up)
10
      paletteIndex++;
11
    else
12
      paletteIndex--;
13
14
    if (paletteIndex >= 255)
15
      up = 0;
16
    else if (paletteIndex <= 0)
17
      up = 1;
18
    }
19
}
20
//------------LOOP-------------
21
22
void loop()
23
{
24
25
  // other stuff
26
  if (lastIndex != paletteIndex)
27
  {
28
    CRGB colour = ColorFromPalette(myPal1, paletteIndex, maxBrightness, LINEARBLEND);
29
    fill_solid(leds, NUM_LEDS, colour);
30
    FastLED.show();
31
    lastIndex = paletteIndex;
32
  }
33
34
  // other stuff...
35
}