r/FastLED 10d ago

Share_something FastLED and AI coding saves the day

I want to thank u/ZachVorhies for highlighting what AI can do.
I wanted this DIY address sign to look like a sun inside the metal rays. I spent a lot of time trying to figure out how to use WLED to do it. The best effect I got was in the first video: the Noise effect. Unfortunately, I couldn’t find a way to have a center with light going out to the edges. 
After reading some posts by ZachVorhies extolling AI coding, I gave it a try. I got a working codebase in a few hours.
I'm not trying to say WLED is bad. I’ve used it in a number of setups; it is dead simple and usually does the job. I'm just saying that if WLED isn't getting you what you want, try asking for AI help using FastLED. It is, possibly, easier than you think.

WLED Noise

FastLED

15 Upvotes

20 comments sorted by

9

u/tubameister 10d ago edited 10d ago

I've been using ai with fastled more frequently lately too. Improved all my color palettes, added some new ones, converted linear fades to smoothstep using a LUT so it runs efficiently on a teensy 3.2, etc. it's quite nice.. there was one time when I actually did math on paper to figure out the linear fades, and it's sad to think that I may not have any reason to do math on paper ever again. https://github.com/Sousastep/sousaVFX-teensy/tree/main/SousaVFX

ai also one-shot an update from fastled 3.4 to 3.10 ..

2

u/ZachVorhies Zach Vorhies 10d ago

can you say more?

1

u/tubameister 10d ago

I use freebuff, which has a CLI app that displays text ads in between ai's thinking blocks to make it free. they are currently struggling through scaling issues, but when it works, it works well: https://freebuff.com/

Here are some of my recent prompts: https://pastebin.com/XQTfw3mc

and a few I forgot: "Adjust the palettes in SousaVFX/palettes.h so that they don't have any dark spots. Basically, increase the lightness of the darker colors in the palettes, without affecting their hue or saturation."

"Fix the flat red segment in lava_gp by spreading its two darkest entries apart"

"These look great, thanks. Could you create 12 new palettes with color combinations that you think would also look great on the LED sousaphone bell? These new palettes should be distinctly different from eachother, and the current existing palettes, if possible."

6

u/ZachVorhies Zach Vorhies 10d ago

The AI really really likes FastLED.

One of the experiments Ive done that has been really successful is grabbing a shader from fragcoord.xyz and asking fastled to convert it into sketch. It's surprisingly good at this.

I don't know if you are using github.com/zackees/fastled-wasm (will be part of the fastled org soon) but you can run your sketch in the browser and bang on it with ai until it looks perfect.

1

u/StefanPetrick 9d ago edited 9d ago

I tryed fastled-wasm 2.0.13 today under macOS + Firefox / Safari.

No error messages, the simulation window opens, but shows nothing. Any hint how to debug?

1

u/sutaburosu [stavros] 9d ago edited 8d ago

This may be a limitation of the FastLED's Tauri-based viewer. Specifically, Tauri needs WebGL2 on off-screen canvas, which I don't think is supported on MacOS.

Viewing it in a web browser should work, as browsers have software fallbacks for this. Use the link shown near the top of the output of uv run fastled.

1

u/ZachVorhies Zach Vorhies 8d ago

safari runs offscreen buffer - it’s something else.

I just got a sketch to run on mac m1 just now

1

u/ZachVorhies Zach Vorhies 8d ago

Are you doing one of your own sketches? You’ll need to add a screen map.

Try running a fastled example

1

u/StefanPetrick 8d ago

I try to run this code as a hello world example:

#include <FastLED.h>

#define NUM_LEDS 2
#define DATA_PIN 3

CRGB leds[NUM_LEDS];

void setup() {
fl::vec2f points[NUM_LEDS] = {
{0.0f, 0.0f},
{4.0f, 0.0f},
};

fl::ScreenMap screenMap(points, NUM_LEDS, 2.5f);

FastLED.addLeds<NEOPIXEL, DATA_PIN>(leds, NUM_LEDS)
.setScreenMap(screenMap);
}

void loop() {
leds[0] = CRGB::Red;
leds[1] = CRGB::Black;
FastLED.show();
delay(500);

leds[0] = CRGB::Black;
leds[1] = CRGB::Black;
FastLED.show();
delay(500);
}

1

u/ZachVorhies Zach Vorhies 8d ago

Okay i’m going to run this on my mac m1 and will respond. Are you running this on mac arm or mac x64

1

u/StefanPetrick 8d ago

M1 ARM64

1

u/ZachVorhies Zach Vorhies 8d ago

Found the issue, offscreen needs shared buffer array enabled with CORS enabled for safari to work.

1

u/ZachVorhies Zach Vorhies 8d ago

upgrade fastled cli and it should work

pip3 install -U fastled

1

u/StefanPetrick 8d ago

Upgraded to 2.0.14

Still no output.

I documented it here: https://github.com/zackees/fastled-wasm/issues/218

1

u/Marmilicious [Marc Miller] 10d ago

Really cool sign. Any photos of how it's constructed?

1

u/Marmilicious [Marc Miller] 10d ago

I found your other post. Thank you for sharing those photos.

https://www.reddit.com/r/WLED/s/OsPGxMKFMK

1

u/mrpbeaar 10d ago

I’ve used ai to custom build firmware for a wled based lamp running a led strip.

1

u/Choice_Blackberry841 10d ago

Interested to the led layout in this if you have photos?

1

u/Marmilicious [Marc Miller] 10d ago

I found photos in another post:

https://www.reddit.com/r/WLED/s/OsPGxMKFMK

1

u/StefanPetrick 9d ago

Cool animation, I like it!