FastLED Basics Episode 3 - Palettes
Ғылым және технология
In the third episode of FastLED basics, we look at palettes. Palettes are a powerful FastLED feature that will help you to create coherent patterns without too much work! We'll have a look at gradient and 16 color palettes, dealing with palettes using online tools, fadeToBlackBy, and finally look at palette blending.
GitHub link for code: github.com/s-marley/FastLED-b...
Gradient color palettes github.com/FastLED/FastLED/wi...
Color utility functions including palettes fastled.io/docs/3.1/group___co...
Palette knife fastled.io/tools/paletteknife/
cpt-city soliton.vm.bytemark.co.uk/pub/...
cssgradient.io cssgradient.io/
If you've found this useful and you'd like to support me to create more stuff, you can now buy me a coffee: www.buymeacoffee.com/scottmarley or buy something from Amazon UK or US at the links below. As an Amazon Associate I earn from qualifying purchases from the links below. It doesn't cost you any more and it helps me to keep making videos!
Amazon UK
Two pack of Arduino Nano clones: amzn.to/3j6UsAq
5m 5V RGB WS2812B LED strip: amzn.to/3j1eFr7
Amazon US
Three pack of Arduino nano clones: amzn.to/3lQH2uk
5m 5V RGB WS2812B LED strip: amzn.to/3pLJaWQ
00:00 - Intro
00:37 - Gradient palettes
04:36 - 16 color palettes
05:15 - fadeToBlackBy
06:34 - Online tools
10:50 - Palette blending
Пікірлер: 134
The best FastLed Tutorial EVER! Continue please!
Scott THANK YOU for these. I've been watching them all today without physically practicing, but I'll be going through them all again hands-on. You're doing an incredible job of introducing new basics and then adding relatively simple but extremely practical complications on top. Exactly what I was looking for.
Thank you so much Scott. This is a great and comprehensive fastled tutorial I have ever seen.
Thanks for this series, its perfectly paced and great references. Please continue producing them, i and im sure all that are watching are learning so much.
This video is awesome! I've been using FastLED for YEARS and I've always been apprehensive for the dive into palettes.. but you've done a fantastic job of explaining it! Thank you!
Another great addition to your Playlist. Ill be referencing your videos for a long time to come. Thanks for the time stamps too. That will definitely help in the future viewings!
Excellent across the board; communication skills, video quality, organization, level of detail and explanation, technical accuracy all come together nicely here. Hope you keep making videos.
Thanx for all your efforts Scott. Can't wait to watch your next tutorial for FastLED :)
Just decided to apply leds and fastled to my project and this video is amazing, thank you for explaining every bit and how it works, now i can do what i had in mind, you showed the way!
Most amazing effects on the LEDs. I am a 56 years (young) beginner in the world of Arduino and individually programmable LEDs. Your videos are like learning A, B, C, D.... covering the most basics and fundamentals... Thank you so much. Great help for people like me..
@ScottMarley
3 жыл бұрын
Thank you!
Thanks Scott. This video "FastLED Basics Episode 3 - Palettes" is fantastic. Palettes are obviously the key to making LEDs dance and your instructions make the abstract concept very understandable. The entire "FastLED Basics" series is must watch TV for anyone that wants to understand how to program LEDs. Thanks again.
Super useful, all the tricks and code sources are really appreciated. Thank you
Thank you so much! These helped me out so much in my projects. This is the most helpful series i've ever found, you deserve all the thanks in the world (:
Awesome job so far. Really easy to follow and makes FastLED accessible to a whole new group of people. Please keep it going!
@ScottMarley
3 жыл бұрын
Thank you, I'll try my best.
Hands down the best FastLED tutorial out there. Thank you.
Thank you SO much for your erudite and lucid instruction on this subject.
loving this so far! You've helped me understand some of the FastLED stuff lately! Perfect timing too! I can't wait to update my ESP32 project
@ScottMarley
3 жыл бұрын
You got this!
You have no idea how helpful this is man. I’ve been looking for something like this for so long. I’m watching all of them. Thanks to you im going to have the coolest room in my apartment complex.
@ScottMarley
3 жыл бұрын
No worries, glad they're helpful!
That's one of the best tutorial i've seen for FASTLED and palettes, i'm gonna use that for my next project, thank you a lot! :D
Amazing! Very simple explananation without much fuzz. Saying this as a programmer (not with C++ or FastLED but this is the first video about FastLED I watched and I think I got it pretty well now...)
Another great lesson. Thanks Scott.
I've learned so much from your videos! Please keep them coming. I just subscribed! ✅
this videos are so helpful and got me to understand fast led a lot faster than I thought thanks you scott
thank you so much !! you made it so easy to understand the palettes and now im hooked!
This is super helpful, definitely going to use this in my next project!
Amazing tutorial Very nice and smooth
It goes straight on so simply class
Lovely, these functions are exactly what I need. Now i even understand the basic foundation of it. Great work Scott!
@ScottMarley
2 жыл бұрын
Thank you!
@TheStonedweedsmoker
2 жыл бұрын
@@ScottMarley i Found one issue and a solution to it, When the LED strip has 255+ LEDS, the pallet assigned should have the specification of 255/255 instead of NUM_LEDS, otherwise it would be 255/300. resulting in a gradient change in all of the leds.
@ScottMarley
2 жыл бұрын
@@TheStonedweedsmoker ah, it depends on what you're trying to do. If you want a palette that runs from one end of a long strip to the other, you could use crgbpalette32 instead.
@TheStonedweedsmoker
2 жыл бұрын
@@ScottMarley Ah yeah, I was just following the tutorial, and when using around 60 LEDs it was all fine. When changing to 300 LEDs it suddenly changed from a gradient running from the left to right to a palette that slowly changed every led at the same time, corresponding to the defined palette
@TheStonedweedsmoker
2 жыл бұрын
I figured changing is to 255 to be the fix for my problem atleast.
Great videos! Thank you for taking the time to do all of this! Helped me learn fastLED so very well
@ScottMarley
2 жыл бұрын
Thabk you! Putting these together helped me understand it too :)
Very nicely explained, never knew we could make our own palettes. Though you needed to be an expert at this.
very cool tutorial, thanks for the effort creating it!
Scott, You talk a little fast, but, after I paused the video over and over , I think I might understand it a little better. I taught this to high schoolers and they loved it! The MORE comments in your code the better for dummies like me. Thanks for your efforts.
Wow, what a series. This one slowed me down a bit but I'm learning a lot. Thanks for your commitment and focus in this matter.
@ScottMarley
3 жыл бұрын
Thank you, glad it helped
@donaldmartin2640
3 жыл бұрын
@@ScottMarley Can you tell me how you plotted the Serial print data? Rather than just numbers? I can see this would be a good tool in the toolbox. Thanks
@ScottMarley
3 жыл бұрын
@@donaldmartin2640 there is a good tutorial for the serial plotter here if that's what you're referring to? arduinogetstarted.com/tutorials/arduino-serial-plotter
@donaldmartin2640
3 жыл бұрын
@@ScottMarley Thanks so much.
@donaldmartin2640
3 жыл бұрын
@@ScottMarley Sorry, it is in the Tools table. Feeling a little dumb. LOL Thanks
I have zero knowledge about programming but you do an awesome job explaining erverything! Thank you so much for all of this!
YOU MADE THE BEST TUTORIALS FOR FASTLEDS
@ScottMarley
3 жыл бұрын
Thank you!
Can't wait to apply some of these pallets to my GEMMA MO.
Hi Scott, just wanted to say thanks for this GREAT tutorial. I'm very new to FastLED (and Arduino in general) and you're speeding me along the learning curve. Your demo on palettes was a huge missing link for me.
@ScottMarley
2 жыл бұрын
Thank you, in really glad it helped!
Hi Scott, Great videos! Thank you for making them. I was wondering if there is a way to run a palette on only the even or odd numbers of leds?
Thank you, learned new things today!
@ScottMarley
3 жыл бұрын
Happy to help!
Hi Scott!! Thank you very much for these videos!! I have a question, is there any way we can implement the patterns not starting from the first LED?? It is very important for the project I'm making :)
I really enjoy these videos on FastLED. Thanks for putting them together. Could you please explain what the difference between NOBLEND and LINEARBLEND is in some of the Palette functions? Thanks
@ScottMarley
2 жыл бұрын
Say we have red, yellow, green, blue in a palette. I think Noblend should display a block of red LEDs, a block of green LEDs etc. Linearblend will gradually blend between the colours, so red blends into yellow, into green etc. However, when I've played with this, it doesn't seem to work. Not sure if I have the wrong idea though!
@seemoo
2 жыл бұрын
@@ScottMarley Thanks for your reply. Makes sense. LINEARBLEND confused me, because if the 1st and last color in the palette are not the same, calling up index 240-255, the color starts to blend back to the 0 index position. I did not expect that. Anyway, thanks again for the great videos. I'm learning a lot!
With 300 LEDs in my array the fill_palette fills all with a solid color, is there something else that needs to be done when using more lights? Your videos are amazing!!!!!
Great video - are you able to explain what the code from Line 72 to 75 does and how it works. Thanks.
Great video. Palette Knife does work on the Opera browser.
Hi Scott- thanks again, i have got most of you projects running. Two questions: is it possible to get one programming running, then another etc, i.e how do you stitch code sequences together. More importantly are there any books or on line tutorials to learn this code format cheers Adrian .
@ScottMarley
3 жыл бұрын
Yep! See episode 5 kzread.info/dash/bejne/mIaMrLOPlNrYn8o.html
Palette blending is neat but is there a simple way to fade or blend from one fill color to another (where the whole strip smoothly moves between specific solid colors)?
Great Job Bro!!!!!! :)
Thanks for the informative video. Is it possible to create pallets on the fly?
@ScottMarley
3 жыл бұрын
Yes, absolutely! You could do something like: CRGBPalette16 myPalette; myPalette[0] = CRGB(255,255,0); ... myPalette[15] = CRGB(169,234,89); Or whatever :) you could go through from 0-15 in a for loop changing each RGB value slowly if you wanted to, use predefined colours or use HSV (although you'd have to convert to RGB I think before you add them to the palette).
Love this video! Is it possible to use paletteknife with a toggle switch? I have been trying to integrate it in another sketch that uses colorpalettes, but it just won't work.
@ScottMarley
3 жыл бұрын
Paletteknife just gives you a way of downloading predefined palettes. Once you have your palette defined, you can use it like any other palette. It is of course possible to switch between a palette using a toggle switch. In pseudo-code: if(digitalRead(toggle_pin)) { fill_palette(blah blah)}; else {fill_palette(blah, blah)}. Which part isn't working?
@justinhawley7783
3 жыл бұрын
@@ScottMarley Ahh I figured out what went wrong. It said 'Sunset_Real_gp' was not declared because I included CRGBPalette16 myPal = Sunset_Real_gp; in the code that already had CRGBPalette16 currentPalette; I was trying to integrate it into Amelia Tetterton's Fastled PaletteButton sketch (codebender.cc/sketch:433123#FastLED%20Palette%20Button.ino) and her void loop was a little less intuitive to me than the one you suggested, but nonetheless it works :) For anyone interested I pasted the code here: pastebin.com/4RnVGi1j The Paletteknife case is the 3rd one. Thanks so much @Scott Marley!
I am really curious about how these leds work . Like with just voltage input how can we controll leds connected in series separately. Please let me know
Couldn't get code at 5:01 to work, had to change your parentheses () framing the palette to curly brackets { } or whatever these things are called. Then had to change "myPal" to "purplePalette" down in the fill_palette line. With these two changes the code worked fine. Very beautiful, in fact!
@ScottMarley
3 жыл бұрын
Thanks for the heads up, I'll check that and correct if if necessary. Glad you figured it out anyhow!
@Themoneymaker36
2 жыл бұрын
Thanks Bro, I almost gave up on that one lol
@diodeskies9087
2 жыл бұрын
Thanks for pointing this out!
So im using the palette code but with 300 leds and once it gets to around 45 or more it starts to flicker or kind of stutter any soultion for this? Thanks
So when doing the color palette at the beginning, I set the NUM_LEDS to 20, but it seems to go past that point and statically illuminate the LED's in the gradient, but they don't move. Expected behavior?
@GrooveYouVerse
5 ай бұрын
QUESTION 2: If I'm undersatnding fadeToBlackBy, it's automatically fading ALL lit pixels to black at once at that time, but the loop goes back and reruns the EVERN_N_MILLISECOND and a new LED is lit with a random palette color. Thus going back to the fade function and it will attempt to fade that pixel to black. I was confused because the function you specify the "leds" and the "NUM_LEDS," and I was expecting some kind of loop function to specify the specific led that just got lit from the above EVERN_N statement.
hi bud you have a new sub l have been looking for this for a very long time so thanks for the vids
@ScottMarley
3 жыл бұрын
Thank you, I hope they help a lot of people get started. LEDs are fun to play with!
How would you use a 16 color palette to change the entire strip from one color to another, instead of scrolling across the strip?
@ScottMarley
3 жыл бұрын
It depends on exacatly the effect you are going for. If you wanted it to smoothly change the whole strip from one color to another through the palette, create your palette as usual (let's call is myPal) outside your loop. Also outside your loop: uint8_t index = 0; Then: loop { EVERY_N_MILLISECONDS(30){ index++ } fill_solid(leds, NUM_LEDS, colorFromPalette(myPal, index)); FastLED.show(); } Or something like that. It very much depends on what you're going for. Make sure the last color in your palette is the same as the first color so when index jumps from 255 back to 0 the color doesn't jump also.
Can you help - wanting to use a button to move between palettes, where should the commands go?
@alheeley
3 жыл бұрын
n/mind - sorted it :) Thx for these excellent videos!
Very nice. But. I would like to be able to start at LED number 18 and go to LED number 66 on a strip of 179 Leds. How would I code that??
@ScottMarley
3 жыл бұрын
It depends on exactly what you want to do, but just address this in your for loop: for (int i = 18; i < 67; i++) { do stuff with LEDs}
@johnnagy1575
3 жыл бұрын
@@ScottMarley I will give that a try. Thank You
Thanks a lot nobody's explain fast led this way grate information...
When I try to use fadeToBlackBy, I notice the whites will faint to red before fizzling out. Is this because of my LED strip quality or is it because of some misconfiguration?
@ScottMarley
2 жыл бұрын
That sounds like it might be a voltage issue on the LEDs (or crappy LEDs!). Check with a multimeter at various points along the strip that your LEDs are all getting around 5V. If not, you might have a power issue.
Hey Scott, amazing videos, one of the best on KZread..one question..i use 60 leds and externsl power supply (20watt) So its more then enough for arduino and leds..but when I disconenct USB from my computer, animstions(for exaple rainbow) it just freeze. Why that happens? Now that I programed lights and I Like it, i would Like to put them and arduino on then wall..so I need to disconenct arduino from computer..but when I do that, the leda just stop right as they were when i pulled USB out from computer..how to continue using automated patterns created for leds without computer? Thank you once again..its amazing what you do.. :)
@ScottMarley
3 жыл бұрын
Make sure your external power supply is connected to the 5V pin (not Vin) and ground pins on the Arduino, as well as to the strip. Other than a power issue, there is no reason that it should stop when you disconnect the usb.
@dokortiz1430
3 жыл бұрын
@@ScottMarley yes, im doing just that, but it freezes when I unplug it..otherwise again, amazing videos..recomending then to frends that have intereset in those stuff..really amazing, keep up with good work..
@ScottMarley
3 жыл бұрын
@@dokortiz1430 Thank you, that's very kind! When the lights freeze, that means the Arduino is no longer talking to them. Have you used a multimeter to check that there is 5V going to the Arduino? I can't see any other reason why it would do that other than a power issue. What happens if you don't connect usb at all, and only connect the power supply?
@dokortiz1430
3 жыл бұрын
@@ScottMarley then nothing happens, only power supply buzzing..and when I connect USB to arduino buzzing stops, and everything Works Like its supposed to..I used your schematics..
@ScottMarley
3 жыл бұрын
@@dokortiz1430 have you measured if the Arduino is getting 5v from the power supply? It shouldn't be buzzing at all, and if it is, it's odd that it stops when connected to the usb. It sounds like a very poor (possibly broken) power supply. Do you have a different power supply to test with? Try it with a phone charger (1A is fine for testing, 2A if you have it) if you have a way to connect it to your LEDs.
Palette move from first pixel to last pixel. How to reverse direction sir? Thank you
Does anyone know if you can use a potentiometer to change gradually between two palettes on one strip?
@ScottMarley
2 жыл бұрын
You could, but you'd have to do it a different way to what I've done here. The trick is to use the blend function. There is an example here of using blend to mix two palettes together using a beat, which isn't what you want to do, but might give you a starting point. gist.github.com/kriegsman/581b90df86b444934729
Hello Scott , I really like the LED Palettes effects, I want these effects to flash according to the line in aux music. Can you share with me? Thank you very much. I'm not an expert in arduino programming so I don't know. edit code. Thanks
And I continue to learn how much I can reduce the code I write and how quickly I can get results compared to the brute force coding method I've been going with over the last 4 or 5 years.
Hi I Used the gradient palette(CSS gradient) but its input color and output color(LED strip) irrelevand. What would be the problem
@ScottMarley
3 жыл бұрын
I would have to see your code. Can you copy it to pastebin and put a link here please?
@ScottMarley
3 жыл бұрын
I don't have access to any of those files (they are not shared with me) copy your code and paste it to pastebin.com/ then link it here.
@ScottMarley
3 жыл бұрын
You need to follow my instructions. I'm not looking at your code on a video. If you can't do what I'm asking you here, you won't be able to fix your code. I'm very busy and don't have time to mess about like this.
@navaratnamkesavan4972
3 жыл бұрын
@@ScottMarley pastebin.com/piHDSCpW
Do you use a stereo microphone? It is a little bit weird wearing headphones. Sometimes you breath just on left side and somethimes only on right xP
@ScottMarley
3 жыл бұрын
That's odd, I'm pretty sure its recording in mono! On audacity there is only one track, usually it displays both if it's stereo. Sorry about that!
@bubbl_media
3 жыл бұрын
@@ScottMarley Maybe a compressor or gate that is in stereo mode? there is definitely a difference between the channels. But I got used to it until episode 5 now :D
Is there a way to use the HEX values?
@ScottMarley
3 жыл бұрын
Yes for example: leds[i] = 0xFF007F;
Dude u rock
how can i add adafruits Pac-Man to my led pallet selections from fastled?? also im not sure if im asking this correctly.
@MrLost38
3 жыл бұрын
kzread.info/dash/bejne/aGiMl9WDepe_e7A.html
@ScottMarley
3 жыл бұрын
Hi Francis, I'm not sure what you're asking me! I don't know what Adafruit's PacMan is or why you posted a video of a flame effect lamp. What are you trying to do?
@MrLost38
3 жыл бұрын
@@ScottMarley Im very new to all of this to include programing. i added the flam lamp so you can look at coding on github hopefully. and id like to add the pacman led and try to merge the two.
@MrLost38
3 жыл бұрын
kzread.info/dash/bejne/p3VlpJhmc7fVpKg.html
@MrLost38
3 жыл бұрын
also id like to apologize if thisnt a worthy question or even allowed here on your page. I do enjoy your videos very much
Yes 👍👍
Do you have a book?
One thing I have yet to see explained is how to run or start a Sketch,.
@ScottMarley
3 жыл бұрын
Hi Martin, I'm not quite sure what you mean? Do you mean how to run anything at all on the Arduino? If so, there are plenty of videos out there on how to upload your first sketch to the board. FastLED is not a good starting point if you've never run an Arduino sketch before - get comfortable with that then come back and have fun with this stuff!
Hey Scott!! Just wanted to suggest a slight improvement to your code. You actually don't need to use "NUM_LEDS - 1" in the call to random8() because the definition of random8() is such that: random8( n, m) == random from N..(M-1) github.com/FastLED/FastLED/wiki/High-performance-math#random Not trying to be a jerk here! Just trying to add something useful. As I said in a previous comment your videos are an absolute asset to the FastLED community and I very much appreciate what you are doing!