Hi, My name is Kurtis and I am an Electronics Engineer and technician. If I posted this in the wrong place please help me get it posted right. This is my first post of a working Demo.
I wanted to share with the forum a sample code of how to make the sc01 plus parallel display and touch work. I have had no luck at making the TFT_eSPI library work and am using Arduino_GFX_Library.h. It is similar to the TFT_eSPI and makes it easier to learn.
Here is the code and I hope it has enough information to be self explanatory.
Thanks
_KR_SC01_PLUS_TOUCH_WORKS_sep25d.ino (4.2 KB)
Glad to hear you got it working.
Thanks for your help.
Hi Kurtis!
I have doubts with the code
It could function with TFT.eSPI or only Arduino IDE?
Because I have troubles uploading it.
Here's the error:
36 | Arduino_DataBus *bus = new Arduino_ESP32LCD8(
Compilation error: expected type-specifier before 'Arduino_ESP32LCD8'
I don't know where's the trouble in the code. If you could explain more of I appreciate it
Here is the example I found and I used it.
#include <Adafruit_FT6206.h>// touch screen
#include <Wire.h> // used to connect the Touch screen
#include <Arduino_GFX_Library.h>
This covers display and touch.
//***************************************************************************
// START DISPLAY SETUP MY SETUP
//*****************************************************************************
#define GFX_BL 45 // define back light CAN DISABLE IF USING PWM TIMER FOR BACKLIGHT BRIGHTNE
// setup pin numbers for the library to use. USER_SETUP.h is NOT USED HERE
Arduino_DataBus bus = new Arduino_ESP32LCD8(
0 / DC /, GFX_NOT_DEFINED / CS /, 47 / WR /, GFX_NOT_DEFINED / RD /,
9 / D0 /, 46 / D1 /, 3 / D2 /, 8 / D3 /, 18 / D4 /, 17 / D5 /, 16 / D6 /, 15 / D7 /);
Arduino_GFX gfx = new Arduino_ST7796(bus, 4 / RST /, 1 / rotation /, true / IPS /);
/*****************************************************************************
- End of Arduino_GFX setting
******************************************************************************/
gfx->fillScreen(BLUE);
#ifdef GFX_BL
pinMode(GFX_BL, OUTPUT);
digitalWrite(GFX_BL, HIGH);
#endif
gfx->setCursor(2, 2);
gfx->print("CLR");
gfx->setCursor(20, 160);
gfx->setTextColor(WHITE);
gfx->setTextSize(1);
gfx->println("Arduino_GFX_Library , Adafruit_FT6206.h , SC01 PLUS Parallel DEMO");
//gfx->drawLine(0,0,200,200,0xFFFF);
gfx->setCursor(0, 300);
// Get flash size and display
gfx->printf("FLASH size: %d bytes", ESP.getFlashChipSize());
gfx->setCursor(0, 310);
// Initialize PSRAM (if available) and show the total size
if (psramFound()) {
gfx->printf("PSRAM size: %d bytes", heap_caps_get_total_size(MALLOC_CAP_SPIRAM));
} else {
gfx->printf("No PSRAM found.");
}
// TOUCH
// Pressed will be set true is there is a valid touch on the screen
bool pressed;
if (ts.touched()) {
// Retrieve a point
TS_Point p = ts.getPoint();
// rotate coordinate system
// flip it around to match the screen.
t_y = map(p.x, 0, 320, 320, 0);
t_x = map(p.y, 0, 480, 0, 480);
gfx->setTextColor(WHITE);
gfx->setTextSize(1);
// touch top left corner to clear screen
if (t_x < 10)
{
if (t_y < 10)
{
gfx->fillRect(0, 0, 480, 320, BLUE);
gfx->setCursor(2, 2);
gfx->print("CLR");
}
}
/*
// uncomment if you want serial debug
Serial.println("Touched ");
Serial.println(t_x,DEC);
Serial.println(t_y,DEC);
Serial.println("");
*/
gfx->fillRect(t_x - 2, t_y - 2, 5, 5, GREEN);
gfx->setCursor(380, 0);
gfx->fillRect(380, 0, 100, 10, BLUE);
gfx->printf("Touch:(%03d,%03d)", t_x, t_y);
pressed = true;
}
}
This is the code I found, if your pins are different you will have to change those.
Good Luck I hope this helps. Sorry it took so long. I am trying to find a job and have spent
a lot of time. I live in North Central Oklahoma, USA. I have electronics engineering and texchnicaal abilities
and some programming skills. Not much available. I am older and almost retired so people want younger persons and
want them to stand all day long. Just can not do it.
Sorry if it is not readable, maybe too much personal stuff.
Have a Great Day!
Kurtis...
forgot to tell you, in setup add this for touch screen
void setup() {
Wire.begin(6, 5); // touch pins
Thks a lot, Kurtis! I'll try it
Hope that code runs, because I've the same board but I don´t know what's the problem.
I tried many codes and ways to upload and see anything in the LCD, but nothing hapens.
Greetings.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.