Beispiel #1
0
uint8_t ColorBeatModeWithCount(int *sound)
{
    uint8_t i;
    uint8_t beat;
    uint8_t currentColor;
    uint8_t beatCounter;
    uint8_t newBrightness;

    beatCounter = 0;
    Color++;
    for(i= 0; i < NUM_LEDS_PER_FACE; i++) 
    {                               
        beat = U_SUB(sound[i+BEAT_MODE_FREQUENCY_OFFSET], BEAT_MODE_NOISE_VALUE);    // Removing Noise, but keep > 0     
        currentColor = MaxColor(LedRunningInfo.leds[i].r, LedRunningInfo.leds[i].g, LedRunningInfo.leds[i].b);
        if (beat > 3 * currentColor)  
        {    
            beatCounter++;
            newBrightness = beat * BRIGHTNESS_FACTOR;            // Higher the Beat => Higher the brightness
            LedRunningInfo.leds[i]                   = CHSV(Color, SATURATION_MAX, newBrightness);
            LedRunningInfo.leds[i+NUM_LEDS_PER_FACE] = CHSV(Color, SATURATION_MAX, newBrightness);
        }
        LedRunningInfo.leds[i].nscale8(224);                                     
        LedRunningInfo.leds[i+NUM_LEDS_PER_FACE].nscale8(224);                                     
    }
    return (beatCounter);
}
Beispiel #2
0
void AnimationCandy::animate(Framebuffer &leds, CHSV baseColor, const uint8_t step)
{
	for(uint8_t i=0; i<GARLAND_LENGTH; ++i) {
		leds[garland_leds[0][i]] = CHSV(baseColor.hue, sin8(step*2), sin8(step));
		leds[garland_leds[1][i]] = CHSV(baseColor.hue, sin8(step*2+127), sin8(step+127));
	}
}
Beispiel #3
0
void update_leds()
{
    static CHSV hsv1 = CHSV(0, 255, 255);
    static CHSV hsv2 = CHSV(170, 255, 255);

    // Rotate colours spectrum
    hsv1.h = (hsv1.h + 1) & 255;
    hsv2.h = (hsv2.h + 1) & 255;

    // Paint the buffer state on the leds
    for (int j = 0; j < NCOLS; j++) {
        long val = buf_in[j] * NROWS;
        for (int i = 0; i < NROWS; i++) {
            int ledval = min(255, val);
            val -= ledval;
            *led_at(i, j) = blend(hsv1, hsv2, ledval);
        }
    }

    // Refresh the leds
    FastLED.show();
    nup++;

    // The bars go down if no music is received
    for (int i = 0; i < BUF_IN_SIZE; i++) {
        buf_in[i] = max(buf_in[i] - 1, 0);
    }
}
Beispiel #4
0
uint8_t RandomBeatModeWithCount(int *sound)
{
    uint8_t i;
    uint8_t beat;
    uint8_t newColor;
    uint8_t beatCounter;
    uint8_t newBrightness;

    beatCounter = 0;
    Color++;
    for( i= 0; i < NUM_LEDS_PER_FACE; i++) 
    {                               
        beat = U_SUB(sound[i+BEAT_MODE_FREQUENCY_OFFSET], BEAT_MODE_NOISE_VALUE);    // Removing Noise, but keep > 0     

        if (beat > (LedRunningInfo.leds[i].r + LedRunningInfo.leds[i].g + LedRunningInfo.leds[i].b))           // Refresh an LED only when the intensity is low
        {
            beatCounter++;    
            newColor      = beat * COLOR_FACTOR + Color;         // Get a Random Color for current leds[i]
            newBrightness = beat * BRIGHTNESS_FACTOR;            // Higher the Beat => Higher the brightness
            LedRunningInfo.leds[i]                   = CHSV(newColor, SATURATION_MAX, newBrightness);
            LedRunningInfo.leds[i+NUM_LEDS_PER_FACE] = CHSV(newColor, SATURATION_MAX, newBrightness);
        }
        LedRunningInfo.leds[i].nscale8(224);                                     
        LedRunningInfo.leds[i+NUM_LEDS_PER_FACE].nscale8(224);                                     
    }
    return (beatCounter);
}
Beispiel #5
0
void LEDRail::setBoltInRail (char memColour, char memStart, char memWidth) {
  unsigned char offsetDither = rand() % 3;
  //memcpy(&((*strip)[memStart]), memData, memWidth);
  //if (memStart > 0) (*strip)[stripNum][memStart - 1] = CHSV(0, 0, 0);
  for (char c = 0; c < memWidth; c++) {
    if (memStart + c - (*effects).bassBendCounter >= 0) {
      if (!flipStrip)
        (*strip)[stripNum][memStart + c - (*effects).bassBendCounter] = CHSV((256 + memColour + (*effects).colourPalatte + ((*effects).bassShakeDir * (*effects).bassShakeCounter) / 2) % 256, 255 - (*effects).bassShakeCounter, 255 * (memWidth - abs(memWidth - 8 * c / 5)) / (memWidth + (memStart + c - (*effects).bassBendCounter) / TAPERDIV));
      else
        (*strip)[stripNum][(STRIPLEN - 1) - (memStart + c - (*effects).bassBendCounter)] = CHSV((256 + memColour + (*effects).colourPalatte + ((*effects).bassShakeDir * (*effects).bassShakeCounter) / 2) % 256, 255 - (*effects).bassShakeCounter, 255 * (memWidth - abs(memWidth - 8 * c / 5)) / (memWidth + (memStart + c - (*effects).bassBendCounter) / TAPERDIV));
    }
    else if (PIXELOUT) { //Twinkle-out effect!
      if (!flipStrip)
        (*strip)[stripNum][RAILLEN + (memStart + c - (*effects).bassBendCounter)] = CHSV(0, 0, 0);
      else
        (*strip)[stripNum][(RAILLEN - 1) - (memStart + c - (*effects).bassBendCounter)] = CHSV(0, 0, 0);
    }
    if ((*effects).crazyCounter && ((memStart + c + offsetDither) % ((*effects).crazyCounter / 1000 + 1))) {
      //Serial.println("pixelate");

      //Serial.println((*effects).crazyCounter);
      if (!flipStrip)
        (*strip)[stripNum][memStart + c] = CHSV(0, 0, 0);
      else
        (*strip)[stripNum][(STRIPLEN - 1) - (memStart + c)] = CHSV(0, 0, 0);
    }
  }
}
Beispiel #6
0
// This function generates a random palette that's a gradient
// between four different colors.  The first is a dim hue, the second is
// a bright hue, the third is a bright pastel, and the last is
// another bright hue.  This gives some visual bright/dark variation
// which is more interesting than just a gradient of different hues.
void SetupRandomPalette()
{
  currentPalette = CRGBPalette16(
                      CHSV( random8(), 255, 32),
                      CHSV( random8(), 255, 255),
                      CHSV( random8(), 128, 255),
                      CHSV( random8(), 255, 255));
}
void ProgressiveColorBands::draw()
{
	uint8_t hue = 0;
	uint8_t saturation = 255;
	uint8_t brightness = 255;

	uint8_t index = 0;
	uint8_t segments = 2;							// Desired number of segments (bands)

	// Repeat this several times, with an increasing number of sgements each time.
	for (int j = 0; j < 4; j++)
	{
		for (int i = 0; i < LEDS_PER_STRIP; i++)
		{
			//		ledsBottom[i] = CHSV(colorsH[index], DEFAULT_SATURATION, DEFAULT_BRIGHTNESS);
			ledsTop[i] = CHSV(hue, saturation, brightness);
			ledsBottom[i] = CHSV(hue + 40, saturation, brightness);
			ledsLeft[i] = CHSV(hue + 80, saturation, brightness);
			ledsRight[i] = CHSV(hue + 120, saturation, brightness);

			// Since i is zero-based, but number of segments is 1-based, we need to use (i + 1) below.
			// Once we have lit up the number of LEDs corresponding to one segment, set the next LED black.
			// Actually, this sets the last LED in each segment to black.
			if ((i + 1) % (LEDS_PER_STRIP / segments) == 0)
			{
				hue += 255 / (segments + 1);
				saturation = 0;
				brightness = 0;
				index++;
			}
			else if ((i + 1) % 4 == 0)
			{
				//hue += 20;
				//saturation = 255;
				//index++;
			}
			else
			{
				saturation = DEFAULT_SATURATION;
				brightness = DEFAULT_BRIGHTNESS;
			}
		}

		updateDisplay(true);
		FastLED.delay(5000);

		// For all but the last iteration, add one to the number of segements (the progression is 2, 3, 4, 6).
		if (j < 2)
		{
			segments++;
		}
		else
		{
			segments += 2;
		}
	}
}
void SynchronousFade::draw()
{
	unsigned char hue = (_elapsed / 32) & 0xff; // luckily for us, HUE_MAX_RAINBOW is 255.

	*solidPixel1 = CHSV(hue, 255, 255);
	fill_solid(frameBuffer, COUNT_WS2811, CHSV(hue, 255, 255));
	hue += 64;

	*solidPixel2 = CHSV(hue, 255, 255);
	*solidPixel3 = CHSV(hue, 255, 255);
	*solidPixel4 = CHSV(hue, 255, 255);
}
Beispiel #9
0
// This function sets up a palette of purple and green stripes.
void SetupPurpleAndGreenPalette()
{
  CRGB purple = CHSV( HUE_PURPLE, 255, 255);
  CRGB green  = CHSV( HUE_GREEN, 255, 255);
  CRGB black  = CRGB::Black;

  currentPalette = CRGBPalette16(
    green,  green,  black,  black,
    purple, purple, black,  black,
    green,  green,  black,  black,
    purple, purple, black,  black );
}
Beispiel #10
0
void AnimationMultiPoints::animate(Framebuffer &leds, CHSV baseColor, const uint8_t step)
{
	Point p1(sin8(step), 42, CHSV(HUE_RED+baseColor.hue, 127, 255));
	Point p2(sin8(255-step), 64, CHSV(HUE_BLUE+baseColor.hue, 255, 255));
	Point p3(sin8(64-step), 32, CHSV(HUE_GREEN+baseColor.hue, 255, 255));

	for(uint8_t col=0; col<COLUMNS; ++col) {
		for(uint8_t line=0; line<LINES; ++line) {
			const uint8_t led_id = column_leds[col][line];
			CRGB color = p1.computeCHSVFor(map(realLine(col, line), 0, 2*LINES, 0, 255));
			color += p2.computeCHSVFor(map(realLine(col, line), 0, 2*LINES, 0, 255));
			color += p3.computeCHSVFor(map(realLine(col, line), 0, 2*LINES, 0, 255));
			leds[led_id] = color;
		}
	}
}
Beispiel #11
0
void WavePixels::reset(){
  for(uint8_t i=0; i< LAYER_COUNT; i++){
    color[i] = CHSV(128, 255, 255);
    cycleTime[i] = 2500;
    hueA[i] = INT16_MAX/2;
  }
}
Beispiel #12
0
void Flicker::update() {
  if (random16(20000) < threshold) {
    FastLED.showColor(CHSV(0, 0, random(0xFF)));
  } else {
    FastLED.showColor(CRGB::Black);
  }
};
Beispiel #13
0
void UserInterface::timerSet(void)
{
    s_seconds = _minutes * 60;
    s_hue = TIMER_HUE_MAX;
    for (uint8_t i = 0; i < NUM_LEDS; i++)
        s_leds[i] = CHSV(s_hue, 255, 255);
    FastLED.show();
}
Beispiel #14
0
void SolidFade::reset(){
  for(uint8_t i=0; i<LAYER_COUNT; i++){
    color[i] = CHSV(128*i,255,255);
    fadeHue[i] = 0;
    fadeSpeed[i] = (-20*i)+10;
    letterStep[i] = 30;
  }
}
Beispiel #15
0
void RainbowSegment::reset(){
  isStatic = true;
  changeOnBeat = true;
  for(uint8_t i=0; i<LAYER_COUNT; i++){
    color[i] = CHSV(128*i,255,255);
    hueStep[i] = 5;
    beatStep[i] = 35;
  }
}
void FastLEDRenderer::render(ParticleSysConfig *g, Particle_Abstract particles[], byte numParticles, CRGB *_leds) {
    byte row, col;
    uint16_t dx, dy;
    unsigned long tempVal;
    CRGB baseRGB;

    //go over particles and update matrix cells on the way
    for(int i = 0; i<numParticles; i++) {
        if (! particles[i].isAlive) {  // only render if particle is alive
            continue;
        }
        if(crop_left > 0 && crop_left * g->res_x > particles[i].x) {  // only render if x-position is inside cropped window
            continue;
        }
        if(crop_top > 0 && crop_top * g->res_y > particles[i].y) {  // only render if y-position is inside cropped window
            continue;
        }
        uint16_t part_x = particles[i].x - (crop_left * g->res_x);
        uint16_t part_y = particles[i].y - (crop_top * g->res_y);
        //generate RGB values for particle
        baseRGB = CHSV(particles[i].hue, 255,255);

        dx = g->res_x - (part_x % g->res_x);
        dy = g->res_y - (part_y % g->res_y);

        //bottom left
        col = part_x / g->res_x;
        row = part_y / g->res_y;
        tempVal = ((unsigned long)dx*dy*particles[i].ttl)/g->res_area;
        if(tempVal > 255) {tempVal = 255;}
        addColor(col, row, &baseRGB, tempVal, _leds);

        //bottom right;
        col++;
        if (col < g->width) {
            tempVal = ((unsigned long)(g->res_x-dx)*dy*particles[i].ttl)/g->res_area;
            if(tempVal > 255) {tempVal = 255;}
            addColor(col, row, &baseRGB, tempVal, _leds);
        }

        //top right
        row++;
        if (col < g->width && row < g->height) {
            tempVal = ((unsigned long)(g->res_x-dx)*(g->res_y-dy)*particles[i].ttl)/g->res_area;
            if(tempVal > 255) {tempVal = 255;}
            addColor(col, row, &baseRGB, tempVal, _leds);
        }

        //top left
        col--;
        if (row < g->height) {
            tempVal = ((unsigned long)dx*(g->res_y-dy)*particles[i].ttl)/g->res_area;
            if(tempVal > 255) {tempVal = 255;}
            addColor(col, row, &baseRGB, tempVal, _leds);
        }
    }
}
Beispiel #17
0
void play_buzz_anim(int team) {
	if(team < 0 || team >= NUM_TEAMS) return;

	clearLEDs();

	int right_dist = (NUM_LEDS - teams[team].end) - 1;

	//'Swoop' part of the animation where leds stream from the left and right
	//to focus on the target range
	for(int frame = 0; frame < NUM_FRAMES; frame++) {

		float pos = (float) frame / (float) NUM_FRAMES;

		int leftpos = round((float) teams[team].st * pos);
		int rightpos = (NUM_LEDS - round((float) right_dist * pos)) - 1;

		if(SWOOP_TEAM_COLS) { //Use team colours for the swoop
			leds[leftpos] = teamcol[team];
			leds[rightpos] = teamcol[team];
		} else { //Use random colours
			leds[leftpos] = CHSV(random(255), 255, 255);
			leds[rightpos] = CHSV(random(255), 255, 255);
		}

		fadeAllLeds(SWOOP_FADE_SPEED);	

		FastLED.show();
		delay(FRAME_DELAY);
	}

	//Swoop complete, focus on the target range
	for(int i = teams[team].st; i <= teams[team].end; i++) {
		leds[i] = teamcol[team];
	}
	FastLED.show();

	while(1) {
		int rv1 = fadeLeds(2, 0, teams[team].st - 1);
		int rv2 = fadeLeds(2, teams[team].end + 1, NUM_LEDS - 1);
		if(rv1 == 0 && rv2 == 0) break;
		FastLED.show();
		delay(POST_SWOOP_FADE_SPEED);
	}
}
Beispiel #18
0
// Process a clock tick
void MidiLeds::tick(unsigned long time) {
    for (size_t i=noteMin; i<=noteMax; i++) {
        if (adsrEnvelopes[i].tick(time)) {
            uint8_t brightness = round(adsrEnvelopes[i].getOutput() * hsvData[i].v);
            if (brightness < parameters.baseBrightness)
                brightness = parameters.baseBrightness;
            leds[i - noteMin] = CHSV(hsvData[i].h, hsvData[i].v, brightness);
        }
    }
}
 void copyToLedsArray(uint8_t (*state)[WIDTH][HEIGHT]) {
     for (int x = 0; x < WIDTH; x++) {
         for (int y = 0; y < HEIGHT; y++) {
             uint8_t hugh = (*state)[x][y];
             if (hugh > 0) {
                 pixel(x, y) = CHSV(hugh, 255, 255);
             }
         }
     }      
 }
Beispiel #20
0
void breat(/* arguments */) {
        /* code */
        int i;
        int k;
        for (i=0; i<46; i++) {
                for (k=0; k<NUM_LEDS; k++) leds[k] = CHSV(85,255, (int)((breatV[i] * 4)+50));
                FastLED.show();
                delay(100);
        };
}
Beispiel #21
0
void Cell::updateLeds() {
  // map the numbers so they're between min/max for each channel
  // uint8_t hue = map(this->hue.value, 0, UINT8_MAX, this->hue.valueMin, this->hue.valueMax);
  // uint8_t saturation = map(this->saturation.value, 0, UINT8_MAX, this->saturation.valueMin, this->saturation.valueMax);
  // uint8_t value = map(this->value.value, 0, UINT8_MAX, this->value.valueMin, this->value.valueMax);

  for (uint8_t j = 0; j < this->numLeds; j++) {
    // this->leds[j] = CHSV(hue, saturation, value);
    this->leds[j] = CHSV(this->hue.value, this->saturation.value, this->value.value);
  }
}
Beispiel #22
0
int RainbowFill::itterate()
{
  for(int i=0; i < num_leds; i++) {
    uint8_t tmp_hue = i * hue_step + hue;
    lamp->setLed(i, CHSV(tmp_hue, 255, 255));
  }
  
  lamp->render();
  hue+=hue_step;
  int base_delay = 10000;
  return base_delay / fps;
}
Beispiel #23
0
void Pendant::toggleCycleMode() {
  if (sleepOnRelease) {
    cyclingMode = !cyclingMode;
    sleepOnRelease = false;
    changeModeOnRelease = false;

    if (cyclingMode) {
      for (uint8_t i = 0; i < 255; i++) {
        FastLED.showColor(CHSV(i, 255, 255));
        FastLED.delay(1);
      }
    } else {
      for (uint8_t i = 255; i > 0; i--) {
        FastLED.showColor(CHSV(0, 0, i));
        FastLED.delay(1);
      }
    }

    lastCycle = now;
  }
}
Beispiel #24
0
static void timer_leds(void)
{
    if (s_hue == TIMER_HUE_MIN)
        return;

    s_hue--;

    for (uint8_t i = 0; i < NUM_LEDS; i++)
        s_leds[i] = CHSV(s_hue, 255, 255);

    if (s_brightness == 0)
        return;

    FastLED.show();
}
Beispiel #25
0
#include <MidiNoteColors.h>

// Color data for (13 color maps x 12 notes)
// Color data taken (& adapted) from: http://mudcu.be/midi-js/js/MusicTheory.Synesthesia.js
const struct CHSV MidiNoteColors::colorData[13][12] = {
    {CHSV(0, 248, 255), CHSV(16, 248, 255), CHSV(31, 240, 255), CHSV(48, 216, 255), CHSV(64, 192, 248), CHSV(84, 240, 224), CHSV(104, 224, 144), CHSV(124, 208, 144), CHSV(134, 216, 160), CHSV(145, 216, 160), CHSV(178, 232, 128), CHSV(193, 240, 128), }, // AEPPLI_1940
    {CHSV(0, 248, 255), CHSV(15, 240, 248), CHSV(31, 240, 255), CHSV(53, 240, 248), CHSV(64, 192, 248), CHSV(71, 192, 232), CHSV(104, 224, 144), CHSV(124, 208, 144), CHSV(164, 232, 128), CHSV(200, 224, 168), CHSV(208, 240, 216), CHSV(216, 240, 176), }, // BELMONT_1944
    {CHSV(164, 232, 128), CHSV(124, 208, 144), CHSV(104, 224, 144), CHSV(74, 192, 144), CHSV(64, 192, 248), CHSV(52, 192, 248), CHSV(31, 240, 255), CHSV(0, 248, 255), CHSV(1, 248, 160), CHSV(208, 240, 216), CHSV(178, 232, 128), CHSV(193, 240, 128), }, // BERTRAND_1734
    {CHSV(0, 248, 255), CHSV(1, 248, 160), CHSV(31, 240, 255), CHSV(53, 240, 248), CHSV(64, 192, 248), CHSV(71, 192, 232), CHSV(104, 224, 144), CHSV(119, 200, 168), CHSV(193, 240, 128), CHSV(208, 240, 216), CHSV(220, 232, 216), CHSV(0, 248, 255), }, // BISHOP_1893
    {CHSV(164, 232, 128), CHSV(179, 240, 136), CHSV(193, 240, 128), CHSV(212, 248, 192), CHSV(0, 248, 255), CHSV(31, 240, 255), CHSV(48, 216, 255), CHSV(64, 192, 248), CHSV(69, 224, 224), CHSV(74, 192, 144), CHSV(90, 208, 152), CHSV(104, 224, 144), }, // FIELD_1816
    {CHSV(64, 192, 248), CHSV(104, 224, 144), CHSV(124, 208, 144), CHSV(145, 216, 160), CHSV(193, 240, 128), CHSV(208, 240, 216), CHSV(211, 240, 160), CHSV(0, 248, 255), CHSV(11, 248, 216), CHSV(11, 248, 216), CHSV(9, 248, 248), CHSV(30, 248, 248), }, // HELMHOLTZ_1910
    {CHSV(0, 248, 255), CHSV(15, 240, 248), CHSV(31, 240, 255), CHSV(52, 192, 248), CHSV(64, 192, 248), CHSV(104, 224, 144), CHSV(124, 208, 144), CHSV(164, 232, 128), CHSV(178, 232, 128), CHSV(193, 240, 128), CHSV(200, 224, 168), CHSV(208, 240, 216), }, // JAMESON_1844
    {CHSV(0, 248, 200), CHSV(0, 248, 255), CHSV(15, 240, 248), CHSV(31, 240, 255), CHSV(64, 192, 248), CHSV(71, 192, 232), CHSV(104, 224, 144), CHSV(124, 208, 144), CHSV(164, 232, 128), CHSV(188, 216, 136), CHSV(208, 240, 216), CHSV(211, 240, 160), }, // KLEIN_1930
    {CHSV(0, 248, 255), CHSV(16, 248, 255), CHSV(31, 240, 255), CHSV(48, 216, 255), CHSV(64, 192, 248), CHSV(104, 224, 144), CHSV(134, 232, 144), CHSV(164, 232, 128), CHSV(179, 240, 136), CHSV(193, 240, 128), CHSV(201, 240, 176), CHSV(208, 240, 216), }, // NEWTON_1704
    {CHSV(0, 248, 255), CHSV(1, 248, 160), CHSV(15, 240, 248), CHSV(31, 240, 255), CHSV(64, 192, 248), CHSV(74, 192, 144), CHSV(104, 224, 144), CHSV(119, 200, 168), CHSV(124, 208, 144), CHSV(193, 240, 128), CHSV(164, 232, 128), CHSV(208, 240, 216), }, // RIMINGTON_1893
    {CHSV(0, 248, 255), CHSV(208, 240, 216), CHSV(64, 192, 248), CHSV(163, 88, 136), CHSV(145, 216, 160), CHSV(1, 248, 160), CHSV(164, 232, 128), CHSV(31, 240, 255), CHSV(193, 240, 128), CHSV(104, 224, 144), CHSV(163, 88, 136), CHSV(145, 216, 160), }, // SCRIABIN_1911
    {CHSV(0, 192, 104), CHSV(0, 248, 255), CHSV(31, 240, 255), CHSV(52, 192, 248), CHSV(64, 192, 248), CHSV(104, 224, 144), CHSV(124, 208, 144), CHSV(164, 232, 128), CHSV(193, 240, 128), CHSV(208, 240, 216), CHSV(0, 192, 104), CHSV(0, 0, 8), }, // SEEMANN_1881
    {CHSV(71, 192, 232), CHSV(104, 224, 144), CHSV(124, 208, 144), CHSV(164, 232, 128), CHSV(193, 240, 128), CHSV(208, 240, 216), CHSV(209, 232, 112), CHSV(1, 248, 160), CHSV(0, 248, 255), CHSV(31, 240, 255), CHSV(65, 112, 248), CHSV(64, 192, 248), }, // ZIEVERINK_2004
};

// Get a MIDI note color using specified color map
struct CHSV MidiNoteColors::get(Maps map, uint8_t note) {
    return MidiNoteColors::colorData[map][note % 12];
}
Beispiel #26
0
// Turn off all Leds
void MidiLeds::allLedsOff(void) {
    for (size_t i=0; i<0x7F; i++) {
        adsrEnvelopes[i].noteOff();
        hsvData[i] = CHSV(0,0,0);
    }
}
Beispiel #27
0
void Mode::tick() {
  //rots->tick();
  fill_solid( strip, Mode::numLeds, CHSV( 0,0,0));
}
Beispiel #28
0
void Leds::introAnimation(void) {
	// Power on animation
	for (int i = 0; i < 256; i++) {
		for (int led = 0; led < sizeof(logoLeds); led++) 
			leds[logoLeds[led]] = CHSV(0, 0, i);

		FastLED.show();
		delay(2);
	}

	delay (20);

	for (int i = 0; i <= 450; i++) {
		for (int led = 0; led < sizeof(logoLeds); led++)
			if (i < 150)
				leds[logoLeds[led]] = CHSV(0, 0, min(255, 300 - i));
			else if (i >= 150)
				leds[logoLeds[led]] = CHSV(0, 0, 225 - i/2);
		
		for (int led = 0; led < sizeof(logoOuterLeds1); led++)
			if (i < 150)
				leds[logoOuterLeds1[led]] = CHSV(0, 0, i);
			else if (i < 300)
				leds[logoOuterLeds1[led]] = CHSV(0, 0, 300 - i);

		for (int led = 0; led < sizeof(logoOuterLeds2); led++)
			if (i > 30 && i < 170)
				leds[logoOuterLeds2[led]] = CHSV(0, 0, i - 30);
			else if (i >= 170 && i < 310)
				leds[logoOuterLeds2[led]] = CHSV(0, 0, 310 - i);

		for (int led = 0; led < sizeof(logoOuterLeds3); led++)
			if (i > 60 && i < 200)
				leds[logoOuterLeds3[led]] = CHSV(0, 0, i - 60);
			else if (i >= 200 && i < 340)
				leds[logoOuterLeds3[led]] = CHSV(0, 0, 340 - i);

		FastLED.show();
		delay(2);
	}

	delay(400);

	for (int i = 0; i < 13; i++) {
		if (i > 2) {
			leds[top[i-3]] = CRGB::Black;
			leds[mid[i-3]] = CRGB::Black;
		}

		if (i > 1 && i < 10) {
			leds[top[i-2]] = CHSV((i-2) * 25, 200, 50);
			leds[mid[i-2]] = CHSV((i-2) * 25, 200, 50);
		}

		if (i > 0 && i < 11) {
			leds[top[i-1]] = CHSV((i-1) * 25, 200, 130);
			leds[mid[i-1]] = CHSV((i-1) * 25, 200, 130);
		}

		if (i < 10) {
			leds[top[i]] = CHSV(i * 25, 200, 210);
			leds[mid[i]] = CHSV(i * 25, 200, 210);
		}

		FastLED.show();
		delay(16);
	}

	delay(120);

	for (int i = 0; i < 13; i++) {
		if (i > 2) {
			leds[bot[(9-i)+3]] = CRGB::Black;
			leds[mid[(9-i)+3]] = CRGB::Black;
		}

		if (i > 1 && i < 10) {
			leds[bot[(9-i)+2]] = CHSV((i-2) * 25, 200, 50);
			leds[mid[(9-i)+2]] = CHSV((i-2) * 25, 200, 50);
		}

		if (i > 0 && i < 11) {
			leds[bot[(9-i)+1]] = CHSV((i-1) * 25, 200, 130);
			leds[mid[(9-i)+1]] = CHSV((i-1) * 25, 200, 130);
		}

		if (i < 10) {
			leds[bot[(9-i)]] = CHSV(i * 25, 200, 210);
			leds[mid[(9-i)]] = CHSV(i * 25, 200, 210);
		}

		FastLED.show();
		delay(16);
	}
}