Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need help creating custom effects #119

Open
mschnati opened this issue May 12, 2021 · 0 comments
Open

Need help creating custom effects #119

mschnati opened this issue May 12, 2021 · 0 comments

Comments

@mschnati
Copy link

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();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant