Skip to content

Instantly share code, notes, and snippets.

@atuline atuline/blend.ino
Last active Oct 25, 2015

Embed
What would you like to do?
Blending using FastLED
/* End to end blending
By: Andrew Tuline
Date: Oct 25, 2015
*/
#include "FastLED.h"
#define LED_PIN 12
#define CK_PIN 11
#define COLOR_ORDER BGR
#define CHIPSET APA102
#define NUM_LEDS 12
CRGB leds[NUM_LEDS];
int max_bright = 32;
CRGB endclr;
CRGB midclr;
void setup() {
Serial.begin (57600);
FastLED.addLeds<CHIPSET, LED_PIN, CK_PIN, COLOR_ORDER>(leds, NUM_LEDS);
FastLED.setBrightness( max_bright );
}
void loop(){
uint8_t speed = beatsin8(6,0,255);
endclr = blend(CRGB::Aqua, CRGB::Orange, speed);
midclr = blend(CRGB::Orange, CRGB::Aqua, speed);
cycle();
FastLED.show();
}
void cycle() {
fill_gradient_RGB(leds, 0, endclr, NUM_LEDS/2, midclr);
fill_gradient_RGB(leds, NUM_LEDS/2+1, midclr, NUM_LEDS, endclr);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.