Тёмный

How to use and why to use Sprites (TFT_espi Programing tutorial) 

Volos Projects
Подписаться 95 тыс.
Просмотров 66 тыс.
50% 1

In this tutorial I will show you how easy is to use basic sprites when you are using TFT display for your project. Sprites are great to avoid flickering of display, to avoid delay function. They are great when you need to update your screen very often.
I decided to use TTGO T-Display because built in tft display.
You can buy TTGO here: www.banggood.com/custlink/G3v...
TUTORIALS
PART1: • How to use TFT_eSPI li...
PART2: • How to use TFT_eSPI li...
PART3: • How to program TTGO T-...
Here is code:
You can buy me coffee here: ko-fi.com/volosprojects
Don't forget to subscribe! Tnx!

Наука

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

 

6 июл 2022

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 137   
@jeffreymorris1752
@jeffreymorris1752 Год назад
Great instructional videos! I remember using sprites in 1983 (40 years ago!) on a Commodore 64. Those were 24×21 pixels and if your sprite resembled anything beyond a blocky blob then you were having a very good day.
@christopherlawes9286
@christopherlawes9286 Год назад
This is the first video of yours I have seen. For me as a beginner, the way you have gone through this is fantastic! Thank you so much.
@VolosProjects
@VolosProjects Год назад
Thank you Christopher, i am glad I helped.
@kennethbeal
@kennethbeal Год назад
@@VolosProjects Thank you so much for your videos! Just bought you a dozen coffees. Don't drink all at once! :) Thanks again.
@qsdrfghgujfddyffguff
@qsdrfghgujfddyffguff Год назад
yes me also
@jamesmor5305
@jamesmor5305 Год назад
I really like the way you structure this video, because it reflects the ways a normal beginner will start over and you shot hot to be a pro
@carloslemos6443
@carloslemos6443 2 года назад
Nice job... I was trying to put lots of code on my Lilygo T-watch (with your graphs and others that I like) and now I'm understanding a little better how do it
@Narfusala
@Narfusala 2 года назад
I haven't started watching, but already am super happy you made this one... i've been trying to understand what a sprite is/does and how to use it to make a little game... but i was still confused a lot! BTW, i normally dont comment on YT, but i just want to say i love your video's, i bought a couple of these ESP32's with a build-in screen for a little project and learned so much from your video's!!!
@VolosProjects
@VolosProjects 2 года назад
Thank you for your support, i hope this tutorial will help you.
@Egon3k
@Egon3k Год назад
i like how you just chill in your garden and make great content for us :)
@sito3453
@sito3453 Год назад
Thank you Volos! I have learned a lot from this video. You explain it in a very clear and funny way. Congratulations!!
@VolosProjects
@VolosProjects Год назад
Thank you, i hope this will be usefull for you. Cheers from Croatia
@arlo4051
@arlo4051 2 года назад
Thank you for the explanations of how this works, quality information on how to program for the LCD is excellent.
@VolosProjects
@VolosProjects 2 года назад
thank you!
@larsjongkees198
@larsjongkees198 Год назад
thank you so much for making video's with this esp board. I picked it for a school project with basicly 0 programming experience, and then i could find almost zero information on how to program it. Your videos saved my project!
@VolosProjects
@VolosProjects Год назад
Nice to hear that :) Thank you!
@raymondmichael4987
@raymondmichael4987 2 года назад
Dude, That's quite huge collection of displays for a single person. Thanks
@M.Voelkel
@M.Voelkel 29 дней назад
Danke dir Volo für die Mühe die du dir gemacht hast - ich konnte viel lernen, zumal mir jetzt vieles klar geworden ist.
@jimsnodgrass8454
@jimsnodgrass8454 Год назад
Very helpful. Seems like learning to use Sprite's is critical to developing great projects. this is a Great video to show why.. Thanks jimS
@sebalew2642
@sebalew2642 2 года назад
Very useful, looking forward to next sprites tutorials!
@chipko
@chipko 2 года назад
Once again an interesting and incredibly useful video. Thank you so much!
@VolosProjects
@VolosProjects 2 года назад
Tnx chipko
@nicktucker4916
@nicktucker4916 2 года назад
Excellent! That was a very good demo of using sprites
@VolosProjects
@VolosProjects 2 года назад
Tnx Nick
@RicardoPenders
@RicardoPenders Год назад
WOW, that was easy... Thanks for sharing, it is very much appreciated here.
@thadsr240
@thadsr240 Месяц назад
not sure when i subscribed but every time i hear you say subscribe i look, this time i'll say thanks for putting so much information out! these display manufacturers should send you free screens every time and pay you!!
@VolosProjects
@VolosProjects Месяц назад
I am glad you did.Thank you😀
@TBoy58_405
@TBoy58_405 2 года назад
Haven’t played with sprites since the days of Commodore 64 (showing my age 😄). Wish I understood them then like I do now. Many thanks! 👍🏾🤓
@capitanschetttino8745
@capitanschetttino8745 Год назад
🤓🤟
@Tony770jr
@Tony770jr 2 года назад
Nice example! Looking forward for more with sprites..
@phaquasystems2685
@phaquasystems2685 2 месяца назад
Absolutely clear explanation thanks
@fluiditynz
@fluiditynz Год назад
Fast to draw front arc and erase rear arc to move circle from an edge.(But beware of undrawn pixels for thin line). Also should always pause after changes to permit persistance of human vision to load the new image to brain. In ideal world, 20ms for recalculations and delay to give 50 frames per second. Ah... I am watching as typing. So I'm theorising that the operations are made to fast ESP32 RAM instead of TFT and then DMA load from RAM to TFT with your img.push operation. Thanks for tutorial!
@jonathanshaw5186
@jonathanshaw5186 4 месяца назад
Thanks for another great video!
@StephenLiljedahl
@StephenLiljedahl Год назад
Great tutorial, very informative.
@qbalsdon
@qbalsdon Месяц назад
Simple, practical and even had birds chirping!
@marshall100w6
@marshall100w6 Год назад
Interesting. Never dis anything with sprites. I’ll try to use them. Thanks one more time. 🤘🏽🤘🏽🤘🏽.
@zyghom
@zyghom Год назад
perfect! I spent so much time on looking for such thingis ;-)
@donaldkormos5529
@donaldkormos5529 2 года назад
Thank you very much ... I did learn something new!!!
@VolosProjects
@VolosProjects 2 года назад
Thank you 😀
@brianmiller6320
@brianmiller6320 2 года назад
Nice Pizza oven! Good tutorial.
@qbitsday3438
@qbitsday3438 Год назад
Subscribed Instantly!
@MPElectronique
@MPElectronique Год назад
I'M IN LOVE WITH THE SPRITES NOW :)
@psprophet
@psprophet Год назад
Liked, favorited, subscribed and appreciated!
@markfairchild6264
@markfairchild6264 Год назад
Thank you! Coffee coming your way!
@VolosProjects
@VolosProjects Год назад
thank you Mark!
@yakacm
@yakacm 2 года назад
Very cool, TY for sharing.
@kunkhmer5246
@kunkhmer5246 Год назад
Thank you very much for your tutorials,...How do you speed up Sprites? It seems to be very slow as compared to non-Sprites.
@Zoonie81
@Zoonie81 Год назад
You rock dude, thanks 👍🏼
@headbangersworld
@headbangersworld Год назад
Interesantno. Razlika je, da se operacie kod sprite rade u memoriji a ne na ekran, tek na kraju se sprite odlikuje na ekran. Sto ukupno ispadne brze i kao neka vrsta doublebuffera. Mozda bi mogao jos i da uklonis ove dve operatie sa "TFT_BLACK" i da koristis "fillSprite(TFT_BLACK)" na pocetku. Po specifikaciju bi moglo biti jos malo brze :)
@jamesclifford194
@jamesclifford194 4 месяца назад
Hey, firstly, thanks for a great video, I'm learning a lot about Arduino/ESP32 at the moment and this has been really informative. Secondly would you mind sharing the sketch for the fuel gauge shown at 20secs? I want to make a speedo gauge and the asthetic of yours is exactly what I'm hoping to achieve. Thanks again!
@BrianDressel
@BrianDressel Год назад
Thank you, very helpful.
@digihz_data
@digihz_data 2 года назад
Great info. Sprite is like a backbufferr I think
@ChrisHalden007
@ChrisHalden007 Год назад
Great video. Thanks
@jrathmer
@jrathmer Год назад
Thank you! That helped a lot understanding (:
@VolosProjects
@VolosProjects Год назад
Thank you Jan ,for comment and for coffee😀
@qsdrfghgujfddyffguff
@qsdrfghgujfddyffguff Год назад
great sir..very useful
@saydiy1528
@saydiy1528 Год назад
good job. the orange ball looks nice, is it OK to use a circle image instead of the ball?
@egorovsa
@egorovsa Год назад
Hey hey Bro! Thanks too much for the tutorial.!
@VolosProjects
@VolosProjects Год назад
Tnx , nice user name :)
@steverileyretired
@steverileyretired 2 месяца назад
Very Good
@mibrahim4245
@mibrahim4245 Год назад
Thank you.. I need your help if possible.. Im using this TFT_eSPI library with my st7735 128x128 display.. and it works great when I show a 16-bit image using pushImage( ) function. but if I print a text on top of it, the text starts flickering. I've tried many things to no avail, but if I change the image to the 8-bit bitmaps it works perfectly ! .. so can I display an 8-bit color image (not bitmap) using this library ?
@KVEL...
@KVEL... 2 года назад
Thanks for this clear explanation! I have learned a lot!
@VolosProjects
@VolosProjects 2 года назад
nice to hear that. thank you
@raymondmichael4987
@raymondmichael4987 2 года назад
Please, I need more on this topic
@yakhoubsurya2657
@yakhoubsurya2657 10 месяцев назад
Nice 👍🏻
@mashurshalehin4972
@mashurshalehin4972 2 года назад
It would be great if you could explain the theory and why it's smoother and better than the other approach. I want to know the behind the scenes implementation process.
@1over137
@1over137 Год назад
The sprite library waits and draws with the refresh. Basically "vSync"
@mashurshalehin4972
@mashurshalehin4972 Год назад
@@1over137 Is it like this, it saves the whole frame in memory and refreshes the whole frame with one shot?
@1over137
@1over137 Год назад
@@mashurshalehin4972 Not necessarily. There are several ways to do it. The approach you suggest would be called "double frame buffer", where you one complete frame ready to go as soon as the display refreshes and you have another frame which the CPU id drawing into. When you complete your drawing, the frames are swapped (usually just by readdressing the memory which is actually read by the display. So no memory moves or is copied, it's just the screen render is pointed to a different frame. The flicker is caused by the software writing into the frame that is currently on screen, so you see a series of partial images as one partial frames get drawn on each screen before it switches. The other way with single buffer, you just wait for the refresh and write the buffer as fast as the screen draws. The better way to have this implemented would be to have a parameter to UpdateDisplay() which is True/False and denotes if the display should wait on the refresh or render immediately.
@eugenecrane6093
@eugenecrane6093 11 месяцев назад
Cool!!! thanks l use ttgo t4
@cdunne1620
@cdunne1620 Год назад
..brilliant video, you’re a great teacher, thank you!! ..are you looking forward to TTGO t-Display Amoled, should be cool
@HPVIDEO10
@HPVIDEO10 2 года назад
Thank you !!!
@carlatashkadeh5890
@carlatashkadeh5890 2 года назад
Thanks!
@andymouse
@andymouse Год назад
Nice !...cheers.
@rynait
@rynait Год назад
was commodore user and did use sprite concept alot. my explanation version to newbie. you are drawing graphic to memory (not to screen), after you done draw graphic (into memory), copy the memory to screen., done, rinse and repeat. to some (and on old computers) yes, this slightly slow graphics viewing-play. but the slowness is offset by the speed of cpu processing the code, modern computer makes it useless because the cpu is far faster and flicker comes back. interesting is unfazed by small development boards.
@MPElectronique
@MPElectronique 2 года назад
here we go!!!! 😊😮😊😊
@gordsh1
@gordsh1 5 месяцев назад
Please do a tutorial / video on how to design a pcb board from a simple circuit using software.
@MaxSMoke777
@MaxSMoke777 Год назад
Where is part 2??? I haven't been able to figure out how to make a masked sprite, I was hoping you had information on that.
@SonalK
@SonalK 2 месяца назад
How do you know which displays are supported? I've a few ST7735 TFT displays, flickers a lot and low resolution
@AJB2K3
@AJB2K3 Год назад
6:21 that's actually a useful bug!
@Darktron
@Darktron Год назад
Can you do a tutorial on using Lvgl library with T-Display S3 make of nice UI, fonts, colors, etc.
@innocent431
@innocent431 Год назад
and willing nice tutoet League teams and players to chose as their editor. More money for tho. It is pretty cool to see the progress I
@shahabaghai
@shahabaghai Год назад
Hi and thanks for great videos, I am finding them very useful. I am working with ESP32-Vroom and 320*240 TFT(SPI), when I define my sprite with full length it does not work (LCD is black) but when I break it into 2 sprit of 120*320 I have no issue and it successfully updates the LCD? Any ideas?
@BlondieSL
@BlondieSL Год назад
Well, you have just answered my question of if an ESP32-WROOM and pretty much any TFT will work. Thanks for that. As for what you mentioned, have you tried messing with the X/Y screen size numbers? Like, perhaps reduce x and y by 1 number and use 1 to 320 (or 1 to 319) instead of 0? I know that with Arduino and TFT screens, I ran into issue of the screen not working right when being too "exact" with the numbers. I tested by reducing the numbers by 1 (I think it was) and then things would work. just an idea.
@j.d.5262
@j.d.5262 9 месяцев назад
OMG where did you get that coffee mug?
@buraksonmez1761
@buraksonmez1761 Год назад
Why am I getting this error when I trying to do something with this ttgo? Sketch uses 18280 bytes (59%) of program storage space. Maximum is 30720 bytes. Global variables use 1882 bytes (91%) of dynamic memory, leaving 166 bytes for local variables. Maximum is 2048 byt
@romarioavila1
@romarioavila1 Год назад
Hy! is possible to develop an menu user interface with sprites?
@nikthefix8918
@nikthefix8918 2 года назад
When ever I hear the word 'Sprite' I think of Mr Claypole in Rentaghost.
@Sergkey42
@Sergkey42 10 месяцев назад
благодарю бро за такое пошаговое объяснение. Можешь рассказать так же про режим DMA на ESP32?
@Scudmaster11
@Scudmaster11 10 месяцев назад
"Takes a drink of sprite while watching a video that is talking about sprites"
@kamran_aghlami
@kamran_aghlami Год назад
Those screen flickers look like image buffer corruption to me. I guess it's because of unaligned memory writes or LCD's driver issue, maybe it has to do with the weird resolution this display has, and I'd say you're essentially bypassing the issue with writing full frame buffer every frame which is less efficient both in terms of CPU cycles and memory usage than the partial screen update the first approach had. I'm interested to figure the real issue out.
@wincydelavega653
@wincydelavega653 Год назад
I use the same display and i use a typical esp32 and i am not using any sprite but it works completely fine but i am happy to learn sprite 🐱
@YourDetector
@YourDetector Год назад
Good stuff!! But as far as I can understand, ONE sprite of 135x200 pixels takes all RAM memory of ESP32 :(
@flashgangster
@flashgangster 10 месяцев назад
Great video. I followed along using ESP32 and ILI9341 (240x320) and it worked great until I tried to make the full-screen 240x320 sprite (scaled up from your example). It will only go so big before it stops working. I'm guessing it's a memory issue and I need som more teaching. I can't seem to find another tutorial that goes deeper :(
@solarprojectuk
@solarprojectuk 7 месяцев назад
Me too! I found the solution - add the line img.setColorDepth(8); to the loop function. It reduces the memory needed and the sprite works well now.
@flashgangster
@flashgangster 7 месяцев назад
@@solarprojectuk thank you!
@ianchan2624
@ianchan2624 7 месяцев назад
ahhaha thanks xD
@BlondieSL
@BlondieSL Год назад
Just to confirm, this doesn't have to be on a TTGO, right? It can be any ESP32 board, like ESP32 WROOOM ? And will any TFT work, like the 4 wire ones, or does it require TFTs that have several wires?
@VolosProjects
@VolosProjects Год назад
This will work on any board that is sušprted by boodmers tft_espi library..
@BlondieSL
@BlondieSL Год назад
@@VolosProjects I tried to confirm if what I found was right, but as expected, even without posting an actual like, the algorithm removed my comment. I hate the YT algo! It really is horrible. It lets seriously bad comments to remain, then removes normal comments. So again, let me try. Is what I'm looking for have the title at the top, left corner of Bodmer T'F'T'_'e'S'P'I' (I add ' to confuse the algo) ?? (LET'S SEE IF THIS COMMENT STICKS... SIGH)
@edgarmatzinger9742
@edgarmatzinger9742 Год назад
Interesting idea. But why don't you use "real" sprites? A circle sprite you just move over the screen? And a number sprite which you update every loop?
@VolosProjects
@VolosProjects Год назад
i dont understand, what is real sprite?
@jonathanshaw5186
@jonathanshaw5186 4 месяца назад
As a TFT_eSPI newbie, this confused me a bit too at first. I expected the circle to be the sprite rather than the screen (or the portion of the screen) that contains the circle.
@Johann75
@Johann75 6 месяцев назад
So, Sprite will paint the objects into the memory one by one and then into the screen in one shot?
@VolosProjects
@VolosProjects 6 месяцев назад
Yes, you are right
@xyntaxxian7615
@xyntaxxian7615 2 года назад
Can you please also tell me what is deleteSprite? What is its importance? How to use it?
@VolosProjects
@VolosProjects 2 года назад
Sprite can use lots of RAM memory, when you dont need sprite anymore you can delete it to free memory
@xyntaxxian7615
@xyntaxxian7615 2 года назад
@@VolosProjects it's because i tried using deleteSprite to clear my screen but it doesn't seem to work, can you please tell me how to use it properly or point me to a tutorial that uses the function
@rickharms1
@rickharms1 3 дня назад
What User Setup do you use in "User_Setup_Select.h"?
@VolosProjects
@VolosProjects 3 дня назад
setup 200, but you need setup pins
@Alan123456789876543
@Alan123456789876543 Год назад
Great example of "Arduino code". You just could use a Frame buffer to avoid ANY of this flickers :\
@marc.lepage
@marc.lepage Год назад
In this case, the sprite is the frame buffer. Or are you saying the display library has more direct support for frame buffers?
@AJB2K3
@AJB2K3 Год назад
Nice video thank you but could you repeat this video but using micropython please?
@VolosProjects
@VolosProjects Год назад
sorry, i dont like micropython and i dont know how to program esp32board using micropython
@AJB2K3
@AJB2K3 Год назад
@@VolosProjects Never mind, I wouldn't have know if I hadn't asked.
@donvukovic7440
@donvukovic7440 Год назад
At time 00:05, we can see your pizza oven. Will you create a tutorial on how to build a pizza oven. Please.
@VolosProjects
@VolosProjects Год назад
Hello, sorry i dont know how to build it, my father build it. Where are you from, my wife surname is also Vukovic.
@donvukovic7440
@donvukovic7440 Год назад
@@VolosProjects My father is from Kralievo, I was born in Cleveland. I would love to go there some day.
@nikthefix8918
@nikthefix8918 2 года назад
Your screen flicker is pacman-esque.
@Xavier_Everwhere
@Xavier_Everwhere 2 года назад
I didn't find. Any sprite bottle😅
@danielsaccomani6277
@danielsaccomani6277 2 месяца назад
Do you only provide the code if they buy you a coffee?
@VolosProjects
@VolosProjects 2 месяца назад
No, usualy in my videos code is free. But this is tutorial , just fallow along and write code i wroted in tutorial, you will learn easier than just copy and past code. I dont have this code anymore.
@danielsaccomani6277
@danielsaccomani6277 2 месяца назад
@@VolosProjects Ah yes, perfectly fair! I looked and couldn't find it, but now I understand. Thanks for the feedback... Do you have a tutorial that teaches how to overlay a numeric counter over a background image? I'm trying to use the information from several videos on your channel, but without success.... Thank you very much for your answer, big hug.
@wchen2340
@wchen2340 6 месяцев назад
I think "why you need double buffering" would be a much more suitable title. whatever. i dont care much about strange arduino lib apis. cya
@krafterHD
@krafterHD 11 месяцев назад
Okay. I'm going to try to explain the problem I'm having with your example. I have a different size display. Mine is 240x240 (size set in the user_settup.h file). Your code line by line works great but if I change the size of the sprite to 240x240 it won't run. All I get is a black screen. I've change the size of it on both x and y and the only time I can get it to run is if the size of the sprite difference between x and y is >= 10. img.createSprite(240, 240); doesn't work. img.createSprite(235, 235); works img.createSprite(240, 231); doesn't work img.createSprite(240, 230); works img.createSprite(230, 240); works img.createSprite(231, 240); doesn't work img.createSprite(239, 231); works img.createSprite(235, 235); works. I'm confused. Could this be something in the user_setup.h? Edit: I found my answer. This may help others. I’m using an ESP32 Wroom 32. “A Sprite is notionally an invisible graphics screen that is kept in the processors RAM. Graphics can be drawn into the Sprite just as they can be drawn directly to the screen. Once the Sprite is completed it can be plotted onto the screen in any position. If there is sufficient RAM then the Sprite can be the same size as the screen and used as a frame buffer. Sprites by default use 16 bit colours, the bit depth can be set to 8 bits (256 colours) , or 1 bit (any 2 colours) to reduce the RAM needed. On an ESP8266 the largest 16 bit colour Sprite that can be created is about 160x128 pixels, this consumes 40Kbytes of RAM. On an ESP32 the workspace RAM is more limited than the datasheet implies so a 16 bit colour Sprite is limited to about 200x200 pixels (~80Kbytes), an 8 bit sprite to 320x240 pixels (~76kbytes). A 1 bit per pixel Sprite requires only 9600 bytes for a full 320 x 240 screen buffer, this is ideal for supporting use with 2 colour bitmap fonts.” github.com/Bodmer/TFT_eSPI#sprites
@mathiasbekker211
@mathiasbekker211 8 месяцев назад
Awesome. Thank you *1000. I'm using an ESP32 WROOM 32D and a 240*240 tft. Changing the sprite size to 240x235 worked for me.
@VolosProjects
@VolosProjects 8 месяцев назад
You have older esp32 module which have less psram, so with sprite so big program crashes. You can try with diferent board
@IvanEng747
@IvanEng747 Год назад
#include TFT_eSPI tft = TFT_eSPI(); TFT_eSprite img = TFT_eSprite(&tft); void setup() { tft.init(); tft.setRotation(1); img.setColorDepth(true); img.setColorDepth(1); //img.setColorDepth(8);// NO IMAGE img.fillSprite(TFT_RED); img.createSprite(480,320); } int x = 0; void loop() { img.fillCircle(x,36,30,TFT_BLACK); x = x + 10; if (x > 480) x = 0; img.fillCircle(x,36,30,TFT_GREEN); img.pushSprite(0, 0); delay(10); } Not work on stm32f401ccu6
@VolosProjects
@VolosProjects Год назад
do you have latest, tft_espi library?
@BlondieSL
@BlondieSL Год назад
@@VolosProjects Any chance that you could post that specific link to the latest? I loved your video. That's how to get a point across. Show first what doesn't work well, then insert what does. This made understanding sprites so easy. Oh, to confirm as above, this should work with any ESP32 board, i.e. ESP32 WROOM and any TFT display? Thanks in advance.
Далее
Exotic Round Displays and How to Use Them
14:21
Просмотров 330 тыс.
Кто понял тот понял
00:24
Просмотров 325 тыс.
Stray Kids <ATE> UNVEIL : TRACK "Stray Kids"
01:28
Round IPS display on GC9A01 controller
27:17
Просмотров 364 тыс.
Bar Graph - Programming Tutorial (TFT_eSPI library)
36:25
Cheap and Easy to Use ESP32 Screen!
8:21
Просмотров 119 тыс.
iPhone перегрелся, что делать?!
1:01
ПОКУПКА ТЕЛЕФОНА С АВИТО?🤭
1:00
S-Pen в Samsung достоин Золота #Shorts
0:38