Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /********* Pleasedontcode.com **********
- Pleasedontcode thanks you for automatic code generation! Enjoy your code!
- - Terms and Conditions:
- You have a non-exclusive, revocable, worldwide, royalty-free license
- for personal and commercial use. Attribution is optional; modifications
- are allowed, but you're responsible for code maintenance. We're not
- liable for any loss or damage. For full terms,
- please visit pleasedontcode.com/termsandconditions.
- - Project: **GIF Display**
- - Source Code NOT compiled for: ESP32 DevKit V1
- - Source Code created on: 2024-11-23 15:30:15
- ********* Pleasedontcode.com **********/
- /****** SYSTEM REQUIREMENTS *****/
- /****** SYSTEM REQUIREMENT 1 *****/
- /* play a gif file on a 128x160 display */
- /****** END SYSTEM REQUIREMENTS *****/
- /* START CODE */
- /****** DEFINITION OF LIBRARIES *****/
- #include <TFT_eSPI.h> //https://github.com/Bodmer/TFT_eSPI
- #include <SPI.h> // Included SPI library for TFT communication
- /****** FUNCTION PROTOTYPES *****/
- void setup(void);
- void loop(void);
- /****** DEFINITION OF LIBRARIES CLASS INSTANCES*****/
- TFT_eSPI tft = TFT_eSPI(); // Create TFT instance
- // GIF animation variables
- const int frames = 10; // Total number of frames in the GIF
- const int animation_width = 128; // Width of the GIF
- const int animation_height = 160; // Height of the GIF
- uint16_t frame[frames][animation_width * animation_height]; // Array to hold the frames
- void setup(void)
- {
- // put your setup code here, to run once:
- tft.init(); // Initialize the TFT
- tft.setRotation(1); // Set the rotation of the display
- tft.setSwapBytes(true); // Set byte order for color
- tft.fillScreen(TFT_WHITE); // Fill the screen with white color
- // Load GIF frames into the frame array (this is a placeholder, actual loading code will depend on your GIF source)
- for (int i = 0; i < frames; i++) {
- // Load each frame into the frame array (this is just a placeholder)
- // You need to implement the actual loading logic based on your GIF format
- // e.g., frame[i] = loadGifFrame(i);
- }
- }
- void loop(void)
- {
- // put your main code here, to run repeatedly:
- for (int i = 0; i < frames; i++) {
- delay(40);
- tft.pushImage(0, 0, animation_width, animation_height, frame[i]);
- }
- }
- /* END CODE */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement