Hardware Used: -
ESP 32 DEVKIT V1 - Processor
ST7735 - Display
I want to load a simple image in the display.
I am making use of just TFT_eSPI library, Push image function.
My ultimate goal is to run a GIF using that Function.
But as I am loading the image it is full of grains
code-
//#include <Adafruit_GFX.h> // Core graphics library
//#include <XTronical_ST7735.h> // Hardware-specific library
#include <SPI.h>
#include <AnimatedGIF.h>
#include "../test_images/badgers.h"
#include <TFT_eSPI.h>
#include "welcome.h"
#include "Anime00.h"
// set up pins we are going to use to talk to the screen
#define TFT_DC 2 // register select (stands for Data Control perhaps!)
#define TFT_RST 4 // Display reset pin, you can also connect this to the ESP32 reset
// in which case, set this #define pin to -1!
#define TFT_CS 5 // Display enable (Chip select), if not enabled will not talk on SPI bus
#define TFT_SCLK 18
#define TFT_MOSI 23
// initialise the routine to talk to this display with these pin connections (as we've missed off
// TFT_SCLK and TFT_MOSI the routine presumes we are using hardware SPI and internally uses 13 and 11
TFT_eSPI tft = TFT_eSPI();
const int pwmFreq = 5000;
const int pwmResolution = 8;
const int pwmLedChannelTFT = 5;
void setup() {
tft.begin();
tft.setRotation(0);
tft.fillScreen(TFT_BLACK);
//tft.setSwapBytes(true);
//tft.invertDisplay(true);
ledcSetup(pwmLedChannelTFT, pwmFreq, pwmResolution);
ledcAttachPin(17, pwmLedChannelTFT);
ledcWrite(pwmLedChannelTFT, 80);
}
void loop()
{
//for(int i=0;i<9;i++)
// for(int i=0;i<12;i++){
// tft.pushImage(0,0,128,128,Animes[i]);
tft.pushImage(0,0,128,128,welcome);
// delay(80);}
//tft.fillScreen(TFT_RED);
//delay(1000);
//tft.fillScreen(TFT_RED);
//delay(1000);
//tft.fillScreen(TFT_BLUE);
//delay(1000);
}
and image that it gives is as follow
next to clear the grains I have used , tft.setSwapBytes(true); function.
It gave me grain less image, but now the red and blue color is swaped.
and now it looks like this -
The image that is originally supposed to load is this.
Is there any way to fix this?
The array of colors used in the program are in R5G6B6 format in 16 bit.