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.
MalwareBytes Probably one of the best tools to prevent and remove all kinds of malware and viruses on Windows and MacOS X.
Osceola, WI My other home-town ... love living there! Osceola rocks!
Links Page These and more of our favorite links can be found on the Links Page.
New Downloads
ConnectMeNow4-v4.0.18-macOS-x86-64.dmgDate: 2024-04-24 - Size: 3.5 MBVersion 4 of ConnectMeNow - A tool for more convenient mounting of network shares under macOS. This is the Intel version which works on Intel and Apple Silicon Macs.
ConnectMeNow4-v4.0.18-macOS-arm64.dmgDate: 2024-04-24 - Size: 3 MBVersion 4 of ConnectMeNow - A tool for more convenient mounting of network shares under macOS. This is the Apple Silicon version (not suitable for Intel).
MiniWOL2 MacOS (64 bits Apple Silicon)Date: 2023-08-01 - Size: 1.2 MBminiWol is a simple, but effective application to send Wake On LAN to network devices. This is the signed 64 bit MacOS ARM (Apple Silicon) version.
MovieScanner2-2.2.3-Windows-32bit-setup.exeDate: 2023-04-12 - Size: 18.6 MBA small application that uses FFProbe to scan your video files and logs these details in a small database. This is the 32 bit Windows version.
MovieScanner2-2.2.2-Linux-GTK-64bits.tar.gzDate: 2023-04-11 - Size: 29.2 MBA small application that uses FFProbe to scan your video files and logs these details in a small database. This is the 64 bit Linux version for GTK.
MovieScanner2-2.2.2-Linux-QT5-64bits.tar.gzDate: 2023-04-11 - Size: 29.1 MBA small application that uses FFProbe to scan your video files and logs these details in a small database. This is the 64 bit Linux version for QT5.
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).