How to program atmega2560 r3 with 3,5"tft for multiple pictures

and wenn it reeches picture 12 it goes back to picture 1 on the next GND signal