Welcome to the Tweaking4All community forums!
When participating, please keep theĀ Forum RulesĀ in mind!
Topics for particular software or systems: Start your topic link with the name of the application or system.
For exampleĀ “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.
Please note that switching to another language when reading a post willĀ not bring you to the same post, in Dutch, as there is no translation for that post!
Oh my, I“ve never thought making some LEDs light up could be so much work. I just don“t have the right mindset for this, so it is really some hard work for me. And most of the time I don“t really know what I“m doing until it works :D
But.....I have now managed to have the gradient without meteor effect pulsing/breathing/fading by using a sine-wave.
I think having the meteor affecting the brightness of the gradient as another effect is some hard work for me now and I might not find a solution. We will see.
#include <FastLED.h>
#define NUM_LEDS 70
#define LED_PIN 5
#define buttonPin1 11
#define buttonPin2 10
#define buttonPin3 9
#define buttonPin4 8
#define buttonPin5 7
int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;
int buttonState5 = 0;
CRGB leds[NUM_LEDS];
uint8_t paletteIndex = 0;
DEFINE_GRADIENT_PALETTE (MTU) {
0, 255, 50, 0,
85, 255, 70, 0,
170, 0, 170, 30,
255, 0, 255, 255
};
CRGBPalette16 myPal = MTU;
void setup() {
FastLED.addLeds<WS2812B, LED_PIN, GRB>(leds, NUM_LEDS);
FastLED.setBrightness(15);
pinMode(buttonPin1, INPUT_PULLUP);
pinMode(buttonPin2, INPUT_PULLUP);
pinMode(buttonPin3, INPUT_PULLUP);
pinMode(buttonPin4, INPUT_PULLUP);
pinMode(buttonPin5, INPUT_PULLUP);
}
void loop() {
uint8_t sinBeat = beatsin8(30, 3, 255, 0, 0);
fill_palette(leds, NUM_LEDS, paletteIndex, 3, myPal, sinBeat, LINEARBLEND);
buttonState1 = digitalRead(buttonPin1); // read the state of the pushbutton value
if (buttonState1 == LOW) {
fill_gradient_RGB(leds, NUM_LEDS, CRGB(0,0,0), CRGB(0,0,0), CRGB(0,0,0), CRGB(0,0,0));
}
leds[66] = CRGB(0, 0, 0);
buttonState2 = digitalRead(buttonPin2); // read the state of the pushbutton value
if (buttonState2 == LOW) {
leds[66] = CRGB(0, 0, 255);
}
leds[67] = CRGB(0, 0, 0);
buttonState3 = digitalRead(buttonPin3); // read the state of the pushbutton value
if (buttonState3 == LOW) {
leds[67] = CRGB(255, 0, 255);
}
leds[68] = CRGB(0, 0, 0);
buttonState4 = digitalRead(buttonPin4); // read the state of the pushbutton value
if (buttonState4 == LOW) {
leds[68] = CRGB(255, 255, 0);
}
leds[69] = CRGB(0, 0, 0);
buttonState5 = digitalRead(buttonPin5); // read the state of the pushbutton value
if (buttonState5 == LOW) {
leds[69] = CRGB(0, 255, 255);
}
FastLED.show();
}
most of the time I don“t really know what I“m doing
Haha, don't worry ... you're not the only one and yes it can be a little but of work 😉Ā
Well, having a proper gradient is an excellent first step ... 👍Ā
Now the next step would be to store that gradient in our reference array (GradientLeds), and the challenge would be to update the GradientLeds with each step we would do for meteor rain (or which ever effect you' like to use). This would have been easier if the Arduino could multitask or [easily] switch tasks. But it cannot (better said: it wasn't designed for that).
Tip for later: replacing the Arduino with an ESP8266 or EPS32 would help things go faster/smoother. These microcontrollers can replace an entire Arduino and are much cheaper (the ESp8266 about $5 if you buy 3 at a time - Amazon.de or Amazon.com and obviously AliExpress has a good selection as well).
Well Iam not be able to get the meteor to be just a brightness effect. So it will not be a colored meteor running down the strip, butĀ just an increased brightness running down the strip.
I want just the gradient and on top of that, the meteor runs through the gradient as usual. But all the meteor does is changing the brightness of the gradient while it is running through the gradient.
Apologies for being confused 🤣Ā Looking at the last code you posted, I couldn't link that with your question 🤔Ā
What code are you using right now - could you post it (again)? With the last code I posted, you could set the meteor rain color to pure white - it should stand out and not just brighten the gradient.
In this part of the meteor rain, we (with each step) first fade the meteor color to the gradient color. Next we draw a fresh meteor, so it should always show the color of the meteor.
I think I didn“t made clear what my goal is. In the following (and just fine working) code, we have the gradient with the meteor running throught. To set the meteor color to white would just give me a white meteor running through.
My Idea was instead of having a meteor with a desired color, is it possible to have the meteor just influencing the brightness of the gradient? So that it looks like we have a gradient (as usual) and then the meteor just makes the gradient brighter just where the meteor is.
Well insted of talking, why don“t I use my 3D animation skills and just show you what I mean (did not animate the meteor decay). See the Video:
Awesome animation - and I think I understand what you're going for! Excellent. So we need to brighten the color where the meteor is drawn, instead of going to full white.
I did a brief test with this change when drawing the meteor - but for some weird reason my USB bus keept dropping power (losing my mouse and keyboard and an unstable Arduino connection - I'll have to look into this later).
So I basically use the fadeTowardColor function to brighten te LED in the spot where we used to draw the meteor with white. In a second cycle it dims back to the original color.
You could also test using these functions instead:
It“s frustrating to not beeing able to wrap my head around this. I know why Iam not a coder. It seems to be a simple task, but I don“t get it. Sorry.
( In the example I had typed "j" and this has to be "i-j")
So the idea is to grab the color in the gradient for the position where we want the color to change. So we grab that color and fade it to a brighter version of that color.
Ā
Now, I've done searching and there may be another option (untested since I cannot test anything right now). I had not heard of this one before, so worth a try I'd say ...
Playing with the maximizeBrightness value is also weird. Lower values make the meteor going to black. Higher values making the meteor brighter, but only to a point where it is again barely visible brighter than the gradient.
XMedia Recode Excellent tool for Windows users to convert pretty much any video format to any other video format, including some helpful options like removing unwanted tracks.
PDFCreator Ultimate tool for Windows users: Print ANYTHING you can print to a PDF with this FREE printer driver.
VueScan Ultimate scanning tool for Windows, Linux, and macOS, supporting pretty much any scanner, even those no longer supported by your OS. (no scanner drivers needed!)
Microsoft PowerToys for Windows 10 Back in the day (Windows 98/XP era) we had PowerToys - Microsoft released them again for Windows 10 (free)
CleverSubmitter Submits your website for indexing with a truckload of search engines.
NAPS2 - Not Another PDF Scanner 2 Wonderful simple and reliable scanner application for Windows users. This still depends on your Windows having the proper scanner drivers installed, but it makes scanning to images or PDFs a lot easier.
Links Page These and more of our favorite links can be found on the Links Page.
New Downloads
RenameMyTVSeries-2.3.7-Windows-x64-setup.exeDate: 2025-08-08 - Size: 48.8 MBRename My TV Series, for Windows (Intel 64 bit), a tool to assist in renaming TV Show episode files. Static builds of ffmpeg and ffprobe are included.
RenameMyTVSeries-2.3.5-macOS-Universal.dmgDate: 2025-07-30 - Size: 98.5 MBRename My TV Series, for macOS (Universal binary for Apple Silicon ARM and Intel 64 bit), a tool to assist in renaming TV Show episode files. Static universal binary builds of ffmpeg and ffprobe are included.
RenameMyTVSeries-2.3.5-QT5-Linux-x64-static-ffmpeg.tar.xzDate: 2025-07-27 - Size: 78.3 MBRename My TV Series, for Linux (64 bit QT5), a tool to assist in renaming TV Show episode files. This bundle comews with rather large static builds of ffmpeg and ffprobe.
RenameMyTVSeries-2.3.5-GTK-Linux-x64-static-ffmpeg.tar.xzDate: 2025-07-27 - Size: 78.3 MBRename My TV Series, for Linux (64 bit GTK), a tool to assist in renaming TV Show episode files. This bundle comes with (large) static builds of ffmpeg and ffprobe.
RenameMyTVSeries-2.3.5-QT5-Linux-x64-shared-ffmpeg.tar.xzDate: 2025-07-27 - Size: 1.9 MBRename My TV Series, for Linux (64 bit QT5), a tool to assist in renaming TV Show episode files. This bundle relies on ffmpeg and ffprobe shared libraries on your system.
RenameMyTVSeries-2.3.5-GTK-Linux-x64-shared-ffmpeg.tar.xzDate: 2025-07-27 - Size: 1.9 MBRename My TV Series, for Linux (64 bit GTK), a tool to assist in renaming TV Show episode files. This bundle relies on ffmpeg and ffprobe shared libraries on your system.
Downloads Page Find these and more Downloads on the Downloads Page, where you will also find articles references, operating system requirements and categories.
Amazon Ads
Support us by doing your shopping at Amazon.com, either click the link, or click one of the links below …
You can also sponsor us through theseĀ Amazon offerings:
Please consider disabling your ad blocker for our website.We rely on these ads to be able to run our website.You can of course support us in other ways (see Support Us on the left).