@david_prentice @ZinggJM
Hi
I'm trying to put some colorful shape on screen and inside which place the analog input from sensor, as you can see sensor value in white color below.
But The problem is when I turn the sensor(potentiometer), the past values mix with new values because the screen don't be reset or clear to show new value, and however I tried to put a code to clear the value I couldn't do it.
When I use tft.init() to clear screen, all my shape will be refresh and blinking which is not desirable(because of low speed of tft).
How can I just refresh the input sensor value (the numbers as below)??
#include <ILI9486_SPI.h> //Hardware-specific library
#if (defined(TEENSYDUINO) && (TEENSYDUINO == 147))
ILI9486_SPI tft(/*CS=*/ 10, /*DC=*/ 15, /*RST=*/ 14);
// for my wirings used for e-paper displays:
#elif defined (ESP8266)
ILI9486_SPI tft(/*CS=D8*/ SS, /*DC=D3*/ 0, /*RST=D4*/ 2); // my D1 mini connection shield for e-paper displays
//ILI9486_SPI tft(/*CS=D8*/ SS, /*DC=D4*/ 2, /*RST=D3*/ 0); // my proto board for RPi display
#elif defined(ESP32)
ILI9486_SPI tft(/*CS=5*/ SS, /*DC=*/ 17, /*RST=*/ 16);
#elif defined(_BOARD_GENERIC_STM32F103C_H_)
ILI9486_SPI tft(/*CS=4*/ SS, /*DC=*/ 3, /*RST=*/ 2);
#elif defined(__AVR)
ILI9486_SPI tft(/*CS=10*/ 8, /*DC=*/ 10, /*RST=*/ 9);
#elif defined(ARDUINO_ARCH_SAM)
ILI9486_SPI tft(/*CS=10*/ SS, /*DC=*/ 6, /*RST=*/ 5); // my proto board
#elif defined(ARDUINO_ARCH_SAMD)
// mapping suggestion for Arduino MKR1000 or MKRZERO
// note: can't use SS on MKR1000: is defined as 24, should be 4
// BUSY -> 5, RST -> 6, DC -> 7, CS-> 4, CLK -> 9, DIN -> 8 // my e-paper connector
ILI9486_SPI tft(/*CS=*/ 4, /*DC=*/ 7, /*RST=*/ 6); // to my proto board
#else
// catch all other default
ILI9486_SPI tft(/*CS=10*/ SS, /*DC=*/ 8, /*RST=*/ 9);
#endif
#if !defined(ESP8266)
#define yield()
#endif
#define BLACK 0x0000
#define BLUE 0x001F
#define RED 0xF800
#define GREEN 0x07E0
#define CYAN 0x07FF
#define MAGENTA 0xF81F
#define YELLOW 0xFFE0
#define WHITE 0xFFFF
void setup() {
Serial.begin(9600);
tft.setSpiKludge(false);
tft.init();
tft.fillScreen(RED); tft.setRotation(1); tft.setTextColor(WHITE); tft.setTextSize(4);
tft.setCursor(30, 30); tft.setRotation(1);
tft.setTextColor(WHITE); tft.setTextSize(2);
tft.drawLine(10, 10, 60, 60, WHITE);
tft.drawFastHLine(30, 20, 40, WHITE);
tft.drawRect(50,50, 80, 100, WHITE);
tft.fillRect(200, 150, 100, 60, BLACK);
tft.fillCircle(200, 100, 30, GREEN);
tft.drawTriangle(40, 5, 40, 60, 70, 60, BLACK);
tft.fillTriangle(70, 70, 20, 200, 90, 50, YELLOW);
tft.drawRoundRect(400, 150, 60, 10, 20, BLUE);
tft.fillRoundRect(100, 150, 60, 50, 20, BLUE);
pinMode(A0,INPUT);
}
void loop() {
float X=analogRead(A0);
tft.setCursor(300, 130);
tft.setTextColor(WHITE);
tft.setTextSize(2);
tft.setRotation(1);
tft.println(X,1);
delay(100);
//tft.init(X);
}