Created
March 14, 2019 16:09
-
-
Save atuline/a021e0e6297828845d800573481894aa to your computer and use it in GitHub Desktop.
Another blend
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
A blending variant | |
By: Andrew Tuline | |
Date: March, 2019 | |
*/ | |
#include "FastLED.h" | |
#define LED_PIN 12 | |
#define CK_PIN 11 | |
#define COLOR_ORDER BGR | |
#define CHIPSET APA102 | |
#define NUM_LEDS 42 | |
CRGB leds[NUM_LEDS]; | |
int max_bright = 32; | |
void setup() { | |
Serial.begin (57600); | |
FastLED.addLeds<CHIPSET, LED_PIN, CK_PIN, COLOR_ORDER>(leds, NUM_LEDS); | |
// FastLED.addLeds<CHIPSET, LED_PIN, COLOR_ORDER>(leds, NUM_LEDS); | |
FastLED.setBrightness( max_bright ); | |
} | |
void loop(){ | |
EVERY_N_MILLIS(50) { | |
cycle(); | |
} | |
FastLED.show(); | |
} | |
void cycle() { | |
CRGB clr1; | |
CRGB clr2; | |
static uint16_t thisphase; | |
uint8_t speed; | |
thisphase += beatsin8(5,0,6) + beatsin8(13,0,6); | |
speed = cubicwave8(32+thisphase); | |
clr1 = blend(CRGB::Blue, CRGB::Red, speed); | |
clr2 = blend(CRGB::Blue, CRGB::Red, speed); | |
fill_gradient_RGB(leds,0,clr1, NUM_LEDS-1, clr2); | |
// fill_gradient_RGB(leds, 0, clr2, NUM_LEDS/2, clr1); | |
// fill_gradient_RGB(leds, NUM_LEDS/2+1, clr1, NUM_LEDS-1, clr2); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment