arduino tft remove blinking

Here you can see the source code : void loop() { for(int index = 5;index < 60;index++) { - Pastebin.com

What I want is to redraw the rectangle at the end of the for cycle withour flickering over the other rectangles already drawn on screen any idea how can I achieve that ?

Also the tft library have PImage when I add it as object almost 35-40% of memory is used for it so how can I dispose that resource from the RAM after I dont need it any more ?

Use a lock out variable.

bool Lock = false; // global or static
.
.
.
if(Lock == false)
{
  ...
  Lock = true; // now it can't get back in. 
}

Then when you need to reset it, just make a function that set Lock back to false.

void reset()
{
  Lock = false;
}

Ok I hope your answer is connected with my first question as far as I can understand !

But can you implement some of the drawing rectangles code in it because I cant get the connection with the lock, whats your idea ?

Thanks in advance

What screen are you using, I might be able to recreate what you're seeing. I need the full code too. A lot of times you can't do anything about the flicker, unless you change the library itself.

Could you also post maybe a video just in case i can't recreate your issue?

This one: LCD

I am using tftLibrary

Edit:
Ok I have a LCD very similar that uses the same background library (ST7735), but the main library TFT, is different. But I will see what I can do.

Ok, I got it working with your code, and I see what you are saying about the flicker, but what exactly are you trying to do?

The flicker is due to the way the rectangles are drawn on screen. Your code is drawing many little boxes really fast, then you have a black box that draws over them. The flicker is there because, the black box is not being drawn fast enough, so what you see is parts of the other boxes still on the screen.

If the flicker is such a burden, then you can always get a DUE, it is much faster(expensive too) and it should get rid of that flicker.

I want the black rectangle to reveale the other rectangles based on index step

Well then instead of drawing all the little rectangles first, make the black rectangle first then draw the little rectangles over it, BUT, not the way you are doing it now. Right now, you are drawing all the little rectangle on the screen all at once. what you should be doing is only drawing the one that should be visible at a certain "index"
So to do this you will either need to use IF/ELSE statements or CASE statements.

If you are not using a DUE or other very fast processor, then your approach of drawing everything first, will not work.