Hello,
Im trying to find a way to make a temperature gauge using a st7789 display with arduino and not have the temperature update without flickering. Is this possible?
Using Arduino MEGA 2560
2inch LCD Module ST7789
This is the code i have so far
#include <Adafruit_GFX.h> // Core graphics library
#include <Adafruit_ST7789.h> // Hardware-specific library for ST7789
#include <SPI.h>
#define TFT_CS 53
#define TFT_RST 9
#define TFT_DC 8
Adafruit_ST7789 tft = Adafruit_ST7789(TFT_CS, TFT_DC, TFT_RST);
#define TFT_MOSI 52 // Data out
#define TFT_SCLK 51 // Clock out
int ThermistorPin = 0;
int Vo;
float R1 = 10000;
float logR2, R2, T,T1;
float c1 = 1.009249522e-03, c2 = 2.378405444e-04, c3 = 2.019202697e-07;
void setup(void) {
Serial.begin(9600);
Serial.print(F("Hello! ST77xx TFT Test"));
tft.init(240, 320); // Init ST7789 320x240
tft.setTextWrap(false);
tft.setRotation(3);
tft.setTextSize(5);
tft.fillScreen(ST77XX_BLACK);
}
void loop() {
Vo = analogRead(ThermistorPin);
R2 = R1 * (1023.0 / (float)Vo - 1.0);
logR2 = log(R2);
T = (1.0 / (c1 + c2logR2 + c3logR2logR2logR2));
T = T - 273.15;
T1 = (T * 9.0)/ 5.0 + 32.0;
tft.setCursor(0, 30);
tft.setTextColor(ST77XX_RED);
tft.println(T1);
delay(10000);
tft.setCursor(0, 30);
tft.setTextColor(ST77XX_BLACK);
tft.println(T1);
}