Тёмный

09-Precision Draw - LED Strip Arduino Tutorial - FastLED Effects - on RGB LED WS2812B 

Dave's Garage
Подписаться 805 тыс.
Просмотров 21 тыс.
50% 1

Episode: Precision drawing using floating point values with FastLED.
Learn Arduino step by step with this FastLED LED Strip effect tutorial for beginners on up. Watch live on the LEDs as Dave works in the editor and debugger, showing you how to craft your own LED strip effects for ARGB (individually addressable RGB) LEDs.
{ Please note: there's a small drawing glitch in the code you see in the video, but the code in Github is correct. Basically, you need to call FastLED.clear(); before DrawMarqueeComparison(); but when I commented out the comet, I forget to clear the strip in the video! }
The Heltec ESP32 module used in the video is available at the following link:
www.amazon.com...
Software Prerequisites: Install the following!
(1) Install the Arduino DESKTOP IDE (not the Web Editor) from www.arduino.cc...
Even though we will not be actively using their IDE, the Arduino software must be installed on the machine even though we'll be using VS Code. Thus, we install the desktop IDE and then never use it. You may wish to launch it and install the ESP32 platform to make it useful for quick scratch projects, etc.
(2) Install Visual Studio Code from
code.visualstu...
Visual Studio Code will be our editor and IDE.
(3) Install the PlatformIO IDE
platformio.org...
PlatformIO IDE is an "environment" for VSCode that includes the compilers, tools, and everything you need to compile, build, and run projects for many systems. The Arduino ESP32 is but one of those, so we must install the ESP32 platform within PlatformIO:
(4) Within PlatformIO/VSCode, install the Espressif ESP32 Platform for Arduino
With those four, you should be able to go to the PlatformIO home page in VSCode and click on "New Project". Enter a project name, select "ESP32 Dev Module" as the board, and Arduino as the framework. You should be greeted with a working, building, deployable project consisting of a single file, main.cpp
All code is available on github:
github.com/dav...

Опубликовано:

 

8 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 70   
@FunBideo
@FunBideo 4 месяца назад
Looks like I’m a few years late seeing this but I must say this method for smooth scrolling is pure genius!
@autodidact7127
@autodidact7127 3 года назад
Thank you Dave!
@IamEqualtoall
@IamEqualtoall 3 года назад
Thanks for the next step in you're altruistic training sequence!
@TheRealStructurer
@TheRealStructurer Год назад
Just about to put some LED's under my glass surface desk, and this series will sure save me a ton of time! Thanks for sharing 👍🏼
@costynvd
@costynvd 3 года назад
Amazing, good stuff! Definitely gonna use this in my projects.
@ca-mue
@ca-mue 3 года назад
the first video i saw from you and directly subscribed. What a sympathic guy! :)
@scoopiezz
@scoopiezz 4 месяца назад
what a real sigma
@robertbauer6723
@robertbauer6723 Год назад
Thanks Dave, this code and the ideas you shared about fractional drawing have been very helpful for my own project. In fact, it was your videos about individually addressable LEDs that got me interested in the first place. I'm using an Arduino Uno now, but plan to move on to ESP32 at some point.
@dvohwinkel
@dvohwinkel 3 года назад
2 new episodes in less than 24 hours?! We are going to have tweak the name to "Dave's Fast and Furious FastLed tutorial" :) Not that I am in any way complaining! :)
@lavem
@lavem 2 года назад
If you followed along like me and you wonder why the whole strip fills half red half green with no animation then you need to put: FastLED.clear(); DrawMarqueeComparison();
@deeeee487
@deeeee487 2 года назад
thanks Dave! I got precision "sub pixel" working sorta in some fixed point 24.8 format on a diff micro. very very cool. Once you saw how easy it is, that it is only a matter of breaking the "width" into portions or chopping on pixel boundrys it was easy! TY
@SisterIdaKnow20
@SisterIdaKnow20 Год назад
12 Twelve days of following the video, almost frame by frame, to find that the video missed one line of code that messed me up.. "FastLED.clear();" was no where to be found, until I dug into github for this episode and did a line by line comparison. (WHEW) Now to try applying to comet or bouncing ball.. Your teaching style does match with my own CDO'ish ness (also called OCDish ness). I have been wanting to learn this and going through each video multiple times.. This one was the challenge that, now that it is accomplished, makes one feel like I am learning. 💝🌈🌻
@scoopiezz
@scoopiezz 4 месяца назад
wat
@cbrsilv15
@cbrsilv15 3 года назад
I don’t know anything about coding, but you make it look much easier than it is! Great videos!!
@reykoschachtschneider4645
@reykoschachtschneider4645 3 года назад
Very nice effect! Only, it took me some time to figure out I need to add a FastLED.clear() befor drawing the MarqueeComparison. I either missed that in the video or you didn't say. I'm not sure. But when it worked it looked impressive!
@MadMatty72
@MadMatty72 3 года назад
The first thing ill try, thanks David.
@jaredg4503
@jaredg4503 2 года назад
Love the videos, any chance of a video on the fireworks or drifting twinkle effects? Great work and explanations.
@RNMSC
@RNMSC 2 года назад
Knowing that the actual 3 LEDs in a pixel in these strips are not arranged one next to another, but in a circle with one color covering the entire width, and the other two covering about half the width each, you could use a variation of what Steve Wozniak developed for the Mac, where the color pixel that directly adjoins the fully illuminated pixel gets illuminated a bit more than the others, the color that remains gets no illumination until the fractional line starts covering it as well. I'm not sure of the arrangement, but suspect it's something like Green across the entire width, Red across half, and blue across the other half. In this case the Green led is adjusted as you are doing, and the red, or blue leds are adjusted as the old technique would. I realize there are differences here as well, considering that the spacing between the pixels in the strip will probably have even more of an impact, as neither the pixels on either a CRT, or LCD screen have the gap between them that all but the tightest light strips do. But it would be interesting to see if it could be applied smoothly, and whether it would look better or worse. Thank you.
@smartups1
@smartups1 Год назад
What an awesome man .
@mikus4242
@mikus4242 3 года назад
Thanks, great break from teaching 1st semester programming.
@DavesGarage
@DavesGarage 3 года назад
You are welcome!
@ishdemon_
@ishdemon_ 3 года назад
@@DavesGarage Wont the SinBeat function will do this same smooth effect? or this is better than that??
@muzaffar.ahmadi
@muzaffar.ahmadi 3 года назад
Thank you Dave...I really love your videos...great information...could you please make one video how to setup ESP 32 and visual code on mac...can’t get it working on mac...it works on windows...thanks
@Goto10Gaming
@Goto10Gaming 3 года назад
Just found ya and LOVE your content, Dave, thank you
@danielheskett
@danielheskett 3 года назад
Hey Dave, first, thanks for all this great content! As to if there’s a faster way to do this, let me begin by saying that I’m only a hobby programmer in C. I was thinking that what if you just sized an array of color pixels that was, say 100 times bigger than the number of LEDs you had and then averaged them out before sending to the strip? I’d be willing to write this and maybe even do a “drag race” but I don’t want to waste my time if you can immediately tell me that it would be less efficient. I bow to your superior experience, sir!
@robertbauer6723
@robertbauer6723 Год назад
Daniel, did you ever try this? Curious about the efficiency. I think one concern would be memory use on smaller uC's like the Arduino Uno. ESP32 not so much.
@criptych
@criptych Год назад
Performance-wise you'd probably be better off with a power-of-two multiplier, like 128 or 64, so that the final division becomes a bit shift. Even 32 or 16 would probably give decent results (and save memory). Keep in mind too that extra "subpixel" values means not just more memory, but also more calculations on each update.
@freedomforall1602
@freedomforall1602 2 года назад
Thank you for the great content
@DasAttorney
@DasAttorney 3 года назад
This is great -thanks for sharing
@scoopiezz
@scoopiezz 4 месяца назад
honestly, float availFirstPixel = 1.0f - (fPos - (long)(fPos)); float amtFirstPixel = min(availFirstPixel, count);
@alanesq1
@alanesq1 2 года назад
Brilliant!
@Fogaata
@Fogaata 3 года назад
Do I need to smoke something to understand this? 😊 great video!!! Subscribed.
@brandondelgado4153
@brandondelgado4153 2 года назад
FastLED has a similar function called blur1d. I dont totally understand the code behind it, so a comparison would be cool.
@OldePhart
@OldePhart 3 года назад
You state to click "personal" recommendations *and* the bell icon. Those choices are mutually exclusive. If I get the RU-vid explanation right, the personal option lets them add video notifications they think you want while the ALL option is everything from you. Do you understand that differently ? I don't want to miss any of yours, but having RU-vid add more that it thinks I want is often not a good option. I have a lot of interests and their math doesn't always add up. .
@ezrakoper
@ezrakoper 3 месяца назад
Dave thanks for the video. Question- is this typing crazy crazy crazy speed is you real typing speed or you speed it up to save video time?
@andymouse
@andymouse 2 года назад
Subbed and liked !.....cheers.
@scoopiezz
@scoopiezz 4 месяца назад
*liked! Cheers.
@vair3273
@vair3273 3 года назад
Dave thanks for all the work...awesome stuff. I do have an issue with this episode's code. I get solid green on the right, solid red on the left with one single yellow but not in the middle (more green then red). Thought it was my typing but nope copied the code from GitHub. I still get the same result. Any thoughts?
@Kagesh53150
@Kagesh53150 3 года назад
I am also getting these results with both my typed code and the GitHub code. I have changed out the LEDs and also changed the GPIO pin with the same result. Could really use some help! I want to add that all of the other effects we've coded are working fine. Thanks, Mark
@DavesGarage
@DavesGarage 3 года назад
Which function is this in, DrawMarqueeComparison()? I'll test out from github an let you know, it's quite possible I checked in a bug at the last second!
@DavesGarage
@DavesGarage 3 года назад
Let me check! Is this DrawMarqueeComparison?
@vair3273
@vair3273 3 года назад
Yes
@Kagesh53150
@Kagesh53150 3 года назад
@@DavesGarage Not sure it's in DrawMarqueeComparison(). For testing, I upped the delay at the end of loop() to 1 sec and you can see the pixels building in color but they never reduce in color as the marquee moves. This is the case for the smooth green marquee as well as the red marquee. I think it could be in DrawPixels() where the first pixel is not being dimmed.
@kurtwerbrouck5439
@kurtwerbrouck5439 2 года назад
Hello Dave I remeber that in one of your scripts/programs you used an array of function . Like that you could scroll in to the array and run all the functions . I cant find it back where is was. Have you an example? Nice videos
@marcelleprinsloo2436
@marcelleprinsloo2436 3 года назад
Loving the videos. Inspired me to now redo my whole Lightsaber OS. One question though, when can we expect the flame effect?
@DavesGarage
@DavesGarage 3 года назад
Working on it right now, it's the next episode I expect!
@usmcmckee
@usmcmckee 3 года назад
Hey Dave, When can we expect your GitHub repo updated?
@neilw2O
@neilw2O 3 года назад
Hi Dave. Been watching your MS live stream stuff, delayed, with great interest. Now you being an arduino IDE user and MS/Windows expert, Is it possible to make the F3 key translate to ctrl-g for find next? I have really tried hard to do this, and now realize your java comments convince me I hate (cpu hungry) java too. Or do I just give up and use an external editor, like notepad++? Thanks. Neil
@Flavourdynamics
@Flavourdynamics 3 года назад
Thanks for the video. I'd love to make this work in two dimensions. Any top-level ideas on what edge cases this might introduce?
@GeorgeC1andonly
@GeorgeC1andonly 10 месяцев назад
Come up on my first hiccup in the code so far - at least I cannot understand why this error is being thrown at me - now I've added these functions and tried to implement them - the interpreter is claiming I cannot 'convert 'CRBG' to float when I used DrawPixels(i, 3, CRGB::Black); or indeed DrawPixels(i, 3, CRGB::Yellow); or anything - it just doesn't want to take the CRGB input - but I've gone over the functions and it doesn't make any sense to me - any ideas where to start looking in to this?
@GeorgeC1andonly
@GeorgeC1andonly 9 месяцев назад
nvm - I figured it out - I think, I was using a for loop with integers not a float - which the function has to receive.
@jamesmcpatterson2733
@jamesmcpatterson2733 3 года назад
Thanx.
@jasonpape8775
@jasonpape8775 Год назад
Hey Dave can you help me out with that flame effect comet?
@youmearea
@youmearea 3 года назад
Hey Dave, I would like to implement DrawPixels in my code but the problem is, Im using lerp8by8 which returns a uint8_t value for the index of my led strip each iteration. Do you have any ideas so I can implement the DrawPixel function while using lerp8by8? The reason I'm using lerp8by8 is that I have four led strips of different lengths that I want to light up from beginning to end at the same time.
@IlIDINOIlI
@IlIDINOIlI 3 года назад
Hi. Could u explain us how to make 2 strips with 2 different lengths work parallel the same effect ? I can't understand what i find in internet Thanks in advance
@user-mq9dy2lj5u
@user-mq9dy2lj5u 3 месяца назад
If anybody has actually figured out how to add this to the bouncing ball effect, please let me know.
@DJGeosmin
@DJGeosmin 2 года назад
you REALLY need to pick up a MA3
@SpikyHegdehog
@SpikyHegdehog 3 года назад
Would these effects work with an arduino uno?
@DavesGarage
@DavesGarage 3 года назад
Many would work, yes! The ESP32 is much more powerful but the Arduino can do a surprising lot!
@SpikyHegdehog
@SpikyHegdehog 3 года назад
@@DavesGarage ok cool! how would I upload the code to the arduino?
@ericlanglaismm
@ericlanglaismm 3 года назад
@@SpikyHegdehog you can use the arduino ide or if you want you can use vs code with the platformio extension then you can create a arduino project from platformio home page.
Далее
IT'S MY LIFE + WATER  #drumcover
00:14
Просмотров 18 млн
Hacking a weird TV censoring device
20:59
Просмотров 3,1 млн
NEVER install these programs on your PC... EVER!!!
19:26
E01: Stupid C++ Tricks with Dave
15:43
Просмотров 334 тыс.
What Are Those Other Weird QR Codes?
16:10
Просмотров 999 тыс.