acidportal- 😈 Worlds smallest Evil Portal on a LilyGo T-QT |
git clone git://git.acid.vegas/acidportal.git |
Log | Files | Refs | Archive | README | LICENSE |
TFT_SPIFFS_BMP.ino (2204B)
1 // This sketch draws BMP images pulled from SPIFFS onto the TFT. It is an 2 // an example from this library: https://github.com/Bodmer/TFT_eSPI 3 4 // Images in SPIFFS must be put in the root folder (top level) to be found 5 // Use the SPIFFS library example to verify SPIFFS works! 6 7 // The example image used to test this sketch can be found in the sketch 8 // Data folder, press Ctrl+K to see this folder. Use the IDE "Tools" menu 9 // option to upload the sketches data folder to the SPIFFS 10 11 // This sketch has been tested on the ESP32 and ESP8266 12 13 //---------------------------------------------------------------------------------------------------- 14 15 //==================================================================================== 16 // Libraries 17 //==================================================================================== 18 // Call up the SPIFFS FLASH filing system this is part of the ESP Core 19 #define FS_NO_GLOBALS 20 #include <FS.h> 21 22 #ifdef ESP32 23 #include "SPIFFS.h" // For ESP32 only 24 #endif 25 26 // Call up the TFT library 27 #include <TFT_eSPI.h> // Hardware-specific library for ESP8266 28 29 // Invoke TFT library 30 TFT_eSPI tft = TFT_eSPI(); 31 32 //==================================================================================== 33 // Setup 34 //==================================================================================== 35 void setup() 36 { 37 Serial.begin(115200); 38 39 if (!SPIFFS.begin()) { 40 Serial.println("SPIFFS initialisation failed!"); 41 while (1) yield(); // Stay here twiddling thumbs waiting 42 } 43 Serial.println("\r\nSPIFFS initialised."); 44 45 // Now initialise the TFT 46 tft.begin(); 47 tft.setRotation(0); // 0 & 2 Portrait. 1 & 3 landscape 48 tft.fillScreen(TFT_BLACK); 49 } 50 51 //==================================================================================== 52 // Loop 53 //==================================================================================== 54 void loop() 55 { 56 int x = random(tft.width() - 128); 57 int y = random(tft.height() - 160); 58 59 drawBmp("/parrot.bmp", x, y); 60 61 delay(1000); 62 } 63 //==================================================================================== 64