Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup()
- {
- FastLED.addLeds<WS2811, DATA_PIN, RGB>(leds, NUM_LEDS);
- pinMode(pm, INPUT);
- EVERY_N_MILLISECONDS(100)
- {
- if (up)
- paletteIndex++;
- else
- paletteIndex--;
- if (paletteIndex >= 255)
- up = 0;
- else if (paletteIndex <= 0)
- up = 1;
- }
- }
- //------------LOOP-------------
- void loop()
- {
- // other stuff
- if (lastIndex != paletteIndex)
- {
- CRGB colour = ColorFromPalette(myPal1, paletteIndex, maxBrightness, LINEARBLEND);
- fill_solid(leds, NUM_LEDS, colour);
- FastLED.show();
- lastIndex = paletteIndex;
- }
- // other stuff...
- }
Add Comment
Please, Sign In to add comment