Skip to content

Need help creating custom effects #119

Open
@mschnati

Description

Hey,
I am not quite sure how to create customs effects since the code is a bit different compared to the standard WS2812FX library and the regular McLighting, where there is examples of how to do it.

Could someone explain to me how to implement this effect that i made for example:

#include "FastLED.h"
#define NUM_LEDS 480
CRGB leds[NUM_LEDS];
#define PIN 7

void setup()
{
FastLED.addLeds<WS2812B, PIN, GRB>(leds, NUM_LEDS).setCorrection( TypicalLEDStrip );
FastLED.setBrightness(50);
}

void loop() {
BounceFill();
}

void BounceFill()
{
for (int k = 16; k > 0; k--)//backwards
{
for (int i = 0; i < k; i++) //pixel
{
for (int j = 0; j < NUM_LEDS / 16; j++) //edges
{
setPixel(i + j * 16, 0, 255, 0);
if (i > 0)
{
setPixel(i - 1 + j * 16, 0, 0, 0);
}
}
FastLED.show();
delay(50);
}
}
setAll(0,0,0);
}

void setPixel(int Pixel, byte red, byte green, byte blue) {
leds[Pixel].r = red;
leds[Pixel].g = green;
leds[Pixel].b = blue;
}

void setAll(byte red, byte green, byte blue) {
for (int i = 0; i < NUM_LEDS; i++ ) {
setPixel(i, red, green, blue);
}
FastLED.show();
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions