Reading a .hex file from an SDcard and displaying it on screen TFT , and ESP32 #2355
Unanswered
davidmonterocrespo24
asked this question in
Q&A - General
Replies: 1 comment 3 replies
-
The problem is because I want to make an animation with several images and the reading of the image is very slow. Could the PSram of the esp32 be used? How can it be used? ` // Open BMP file from SD card // Read data from the BMP file and store it in a buffer in PSRAM memory // Display the image on the TFT screen // Close the file and free the PSRAM memory |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
You can read a BPM file that was on a sdcard and display it on a TFT screen with an esp32. I could notice that it is somewhat slow and takes about 4 or 6 seconds to finish. However, the same photo converted to hexadecimal and put into an array is displayed on the screen in less than a second.
How to read a hex file of a photo on the SD card, and convert it to an array to be able to render it on the TFT screen with an esp32?
Something like this
`
#include <Adafruit_ST7735.h>
#include <SD.h>
// Declare the TFT object
Adafruit_ST7735 tft = Adafruit_ST7735(TFT_CS, TFT_DC, TFT_RST);
// Declare the image array
uint8_t image[100000];
void setup() {
tft.begin(); // Initialize the TFT
SD.begin(SD_CS);
File myFile = SD.open("imagen.hex", FILE_READ);
if (myFile) {
int i = 0;
while (myFile.available()) {
image[i] = myFile.read();
i++;
}
myFile.close();
}
}
void loop() {
tft.pushImage(0, 0, 128, 128, image); // Display the image at position (0, 0) //with a size of 128x128
}
`
Beta Was this translation helpful? Give feedback.
All reactions