search
[last updated: 2024-07-12]
WT32-SC01 display
https://doc-tft-espi.readthedocs.io/
-----
Editing in process ...
Do these first...
tft.setCursor(x-pos, y-pos);
tft.setTextSize(5);
Not sure how to "activate" or select them ...
...
---------------------------------------------------
spr02.createSprite(50, 50);
spr02.fillScreen(TFT_TRANSPARENT);
spr02.fillTriangle(25, 0, 0, 49, 49, 49, TFT_RED);
spr02.pushSprite(20, 20, TFT_TRANSPARENT);
delay(1000);
spr02.fillScreen(TFT_TRANSPARENT); // not sure what this does ...
// Draw some text with Middle Centre datum
spr.setTextDatum(MC_DATUM);
spr.drawString("Sprite", WIDTH / 2, HEIGHT / 2, 4);
// misc code snippets for sprites:
//
// static LGFX_Sprite sprite(&lcd); // in globals
// sprite.createSprite(65, 65); // in setup
// sprite.drawRect(0, 0, 65, 65, 0xFFFF);
// sprite.pushSprite(&lcd, 0, 64);
// sprite.deleteSprite();
-----------------------
Links for scrolling a plot:
---------------------------------------------------
---------------------------------------------------
#define TOUCH_CS PIN_D2 // Chip select pin (T_CS) of touch screen
//Here we create our TFT_eSPI object and name it tft
TFT_eSPI tft = TFT_eSPI();
To keep things simple, we will continuously poll our screen to check if our majestic fingers are pressing down on the device. But we want to keep the loop function tidy, so I'm going to wrap the logic in a new function called checkTouched().
cpp
//It's a void function since we don't return anything
//This function will mainly excecute the logic for the touch handling
void checkTouched(){
//Remember this function returns false if the touch is invalid
//C++ asserts something as true if it's not 0. So with a valid press
//This statement will assert to true
if(tft.getTouch(&t_x, &t_y){
}
}
void loop(){
checkTouched();
}
#define TFT_CS PIN_D8 // Chip select control pin D8
For the touch screen to work with ESP32 you must un-comment the line below in the “User_Setup.h” file.
Run the diagnostic sketch Read_User_Setup and check the compiler is picking up your settings by looking at the Serial Monitor output. Note that touch only works with SPI displays and XPT2046 touch controllers. In other cases an alternative touch library can be used.
Display driver = 7796
Display width = 320
Display height = 480
MOSI = GPIO 23
MISO = GPIO 19
SCK = GPIO 18
TFT_CS = GPIO 15
TFT_DC = GPIO 2
TFT_RST = GPIO 4
TOUCH_CS = GPIO 0
Run the diagnostic sketch Read_User_Setup and check the compiler is picking up your settings.
---------------------------------------
https://www.youtube.com/watch?v=d11c48N7zck ... maybe, but uses Lovyan ...
---------------------------------------------------
eof