# ESP32 (WT32-SC01) problems getting started

**URL:** <http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428>\
**Category:** How to\
**Created:** [September 13, 2022, 12:15am UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428 "2022-09-13T00:15:22Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![do\_not\_sleep](http://forum.squareline.io/letter_avatar_proxy/v4/letter/d/c89c15/32.png) [@do\_not\_sleep](http://forum.squareline.io/u/do_not_sleep)\
**Post date:** [September 13, 2022, 12:15am UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/1 "2022-09-13T00:15:22Z")

</div>

### What do you want to achieve?

i would like to be pointed in the direction of a arduino sketch that will work with my esp board,i have the project exported and included in the the arduino ide,im just not sure what to put in the main sketch file to make this thing all come together

### What have you tried so far?

a few youtube tutorials but not luck or clear explanation

### Screenshot or video

### Others

- **SquareLine Studio version:** 1.1.0
- **Operating system:** windows
- **Target hardware:** esp32 wt32-sc01 touch screen dev-board

---

<div class="post-metadata">

**Author:** ![kisvegabor](http://forum.squareline.io/user_avatar/forum.squareline.io/kisvegabor/32/537_2.png) [@kisvegabor](http://forum.squareline.io/u/kisvegabor)\
**Post date:** [September 13, 2022, 7:35am UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/2 "2022-09-13T07:35:51Z")

</div>

Have you exported the Arduino project from SquareLine? If so, please take a look at the README.

Basically you can configure the pin connection in `libraries/TFT_eSPI/User_Setup.h `.

---

<div class="post-metadata">

**Author:** ![pepito](http://forum.squareline.io/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pepito](http://forum.squareline.io/u/pepito)\
**Post date:** [October 1, 2022, 3:42pm UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/3 "2022-10-01T15:42:46Z")

</div>

Hi, have similar problems to get a very small example up and running on WT32-SC01 3.5".  
I handmade already some lvgl / TFT\_eSPI GUI’s for that board, so the pin connection seems to be correct.  
My Squareline example contains only 5 objects, is my starting point to verify that the flow is working.  
Simulation works as expected.  
Export-\>Create Template Project worked fine.  
Compile ( Arduino ) and upload successful.  
But then I get only random pattern, so there is nothing written to the LCD.  
For test reasons I add  
tft.fillScreen(TFT\_YELLOW);  
at the end of setup()  
Then the display is filled yellow. ( works fine with other colors, also )

So there is something wrong with my setup.  
I’m on Windows 11, all available updated are installed.

I tried other lvgl / TFT\_eSPI examples, independent from Squareline, they are working fine.  
I expect, there is something wrong in my setup. I’m unable to find it. Spent a lot of time, watch interesting videos, but still hanging.

Any idea?  
Thanks in advance  
Pepito

---

<div class="post-metadata">

**Author:** ![pepito](http://forum.squareline.io/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pepito](http://forum.squareline.io/u/pepito)\
**Post date:** [October 1, 2022, 3:44pm UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/4 "2022-10-01T15:44:49Z")

</div>

I forgot, Pin connections for that board:  
#define TFT\_MISO 12  
#define TFT\_MOSI 13  
#define TFT\_SCLK 14  
#define TFT\_CS 15  
#define TFT\_DC 21  
#define TFT\_RST 22  
#define TFT\_BL 23

---

<div class="post-metadata">

**Author:** ![dronecz](http://forum.squareline.io/letter_avatar_proxy/v4/letter/d/49beb7/32.png) [@dronecz](http://forum.squareline.io/u/dronecz)\
**Post date:** [October 1, 2022, 8:22pm UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/5 "2022-10-01T20:22:00Z")

</div>

Try [this](https://github.com/0015/ThatProject/blob/master/ESP32_LVGL/LVGL8_SquareLine/02_Tesla_Multi_Pages/02_Tesla_Multi_Pages.ino) code, I think he is using same displey. You can see [here](https://www.youtube.com/watch?v=7PXBPRm_8_Y&ab_channel=ThatProject) how it works. I hope it helps.

---

<div class="post-metadata">

**Author:** ![pepito](http://forum.squareline.io/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pepito](http://forum.squareline.io/u/pepito)\
**Post date:** [October 1, 2022, 10:59pm UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/6 "2022-10-01T22:59:18Z")

</div>

Thanks, this dis help a little bit.  
Random pattern are gone, display is dark, I’m able to dimm the backlight.  
But I’m still missing the generated UI … that one works in simulation.  
Compile, upload, everything is ok, no warning, no error.  
#define LV\_TICK\_CUSTOM 1 … of course 😏

Any idea or has somebody a very small example for the WT32-SC01 3.5" board?  
Thanks and have a good day  
Pepito

/\* My ui.ino \*/  
#include \<lvgl.h\>  
#include “ui.h”  
#define LGFX\_USE\_V1  
#include \<LovyanGFX.hpp\>  
#include \<FT6236.h\>  
#define SDA\_FT6236 18  
#define SCL\_FT6236 19  
FT6236 ts = FT6236();

class LGFX : public lgfx::LGFX\_Device  
{  
lgfx::Panel\_ST7796 \_panel\_instance;  
lgfx::Bus\_SPI \_bus\_instance; // SPI  
lgfx::Light\_PWM \_light\_instance;

public:  
LGFX(void)  
{  
{ //  
auto cfg = \_bus\_instance.config(); //  
cfg.spi\_host = VSPI\_HOST; // (VSPI\_HOST or HSPI\_HOST)  
cfg.spi\_mode = 0; // SPI(0 ~ 3)  
cfg.freq\_write = 40000000; //  
cfg.freq\_read = 16000000; //  
cfg.spi\_3wire = false; // MOSI true  
cfg.use\_lock = true; //  
cfg.dma\_channel = 1; // Set the DMA channel (1 or 2. 0=disable)  
cfg.pin\_sclk = 14; // SPIのSCLK  
cfg.pin\_mosi = 13; // SPIのMOSI  
cfg.pin\_miso = 12; // SPIのMISO  
cfg.pin\_dc = 21; // SPIのD/C (-1 = disable)  
\_bus\_instance.config(cfg); //  
\_panel\_instance.setBus(&\_bus\_instance); //  
}

```
{ //
  auto cfg = _panel_instance.config(); // 
  cfg.pin_cs = 15; // CS(-1 = disable)
  cfg.pin_rst = 22; // RST(-1 = disable)
  cfg.pin_busy = -1; // BUSY(-1 = disable)
  cfg.memory_width = 320; // 
  cfg.memory_height = 480; //
  cfg.panel_width = 320; //
  cfg.panel_height = 480; //
  cfg.offset_x = 0; //
  cfg.offset_y = 0; //
  cfg.offset_rotation = 0; //
  cfg.dummy_read_pixel = 8; //
  cfg.dummy_read_bits = 1; //
  cfg.readable = true; //
  cfg.invert = false; //
  cfg.rgb_order = false; //
  cfg.dlen_16bit = false; //
  cfg.bus_shared = true; //

  _panel_instance.config(cfg);
}

{ //
  auto cfg = _light_instance.config(); //

  cfg.pin_bl = 23; //
  cfg.invert = false; // true
  cfg.freq = 44100; //
  cfg.pwm_channel = 7; //

  _light_instance.config(cfg);
  _panel_instance.setLight(&_light_instance); //
}

setPanel(&_panel_instance); //

```

}  
};

LGFX tft;

/_Change to your screen resolution_/  
static const uint32\_t screenWidth = 320;  
static const uint32\_t screenHeight = 480;  
static lv\_disp\_draw\_buf\_t draw\_buf;  
static lv\_color\_t buf[screenWidth \* 10];

/\* Display flushing \*/  
void my\_disp\_flush( lv\_disp\_drv\_t \*disp, const lv\_area\_t \*area, lv\_color\_t \*color\_p )  
{  
uint32\_t w = ( area-\>x2 - area-\>x1 + 1 );  
uint32\_t h = ( area-\>y2 - area-\>y1 + 1 );

tft.startWrite();  
tft.setAddrWindow( area-\>x1, area-\>y1, w, h );  
// tft.pushColors( ( uint16\_t \* )&color\_p-\>full, w \* h, true );  
tft.writePixels((lgfx::rgb565\_t \*)&color\_p-\>full, w \* h);  
tft.endWrite();

lv\_disp\_flush\_ready( disp );  
}

/_Read the touchpad_/  
void my\_touchpad\_read( lv\_indev\_drv\_t \* indev\_driver, lv\_indev\_data\_t \* data )  
{  
if(ts.touched()){  
data-\>state = LV\_INDEV\_STATE\_PR;  
TS\_Point p = ts.getPoint();  
data-\>point.x = p.y;  
data-\>point.y = tft.height() - p.x;  
}else{  
data-\>state = LV\_INDEV\_STATE\_REL;  
}  
}

void setup()  
{  
Serial.begin(115200);

tft.begin();  
tft.setRotation(1);  
tft.setBrightness(255); // works fine

if(!ts.begin(40, SDA\_FT6236, SCL\_FT6236)){ // works fine  
Serial.println(“Unable to start the capacitive touch Screen.”);  
}

lv\_init();  
Serial.println(“lv\_init done”);  
lv\_disp\_draw\_buf\_init( &draw\_buf, buf, NULL, screenWidth \* 10 );

/_Initialize the display_/  
static lv\_disp\_drv\_t disp\_drv;  
lv\_disp\_drv\_init(&disp\_drv);  
Serial.println(“Display Init done”);  
/_Change the following line to your display resolution_/  
disp\_drv.hor\_res = screenWidth;  
disp\_drv.ver\_res = screenHeight;  
disp\_drv.flush\_cb = my\_disp\_flush;  
disp\_drv.draw\_buf = &draw\_buf;  
lv\_disp\_drv\_register(&disp\_drv);  
Serial.println(“Set Display Properties done”);  
/_Initialize the (dummy) input device driver_/  
static lv\_indev\_drv\_t indev\_drv;  
lv\_indev\_drv\_init(&indev\_drv);  
indev\_drv.type = LV\_INDEV\_TYPE\_POINTER;  
indev\_drv.read\_cb = my\_touchpad\_read;  
lv\_indev\_drv\_register(&indev\_drv);  
Serial.println(“Set Dummy Input Device done”);  
ui\_init();  
Serial.println(“ui\_init() done”);  
}

void loop()  
{  
lv\_timer\_handler(); /\* let the GUI do its work \*/  
delay( 5 );  
}

---

<div class="post-metadata">

**Author:** ![pepito](http://forum.squareline.io/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pepito](http://forum.squareline.io/u/pepito)\
**Post date:** [October 2, 2022, 11:50pm UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/7 "2022-10-02T23:50:29Z")

</div>

I start from scratch again, now it works with my own simple example. It’s a good starting point.  
Touch is working fine…  
But I’m unable to make the audio mixer example work on my device.  
I set the width = 320, height = 480, resize and move some objects, that everything fits on screen,  
but the result is only a white screen 🙂  
Touch is not operating ( have no debug outputs ).  
I expect, the process is hanging on some place, or not started.  
But my own stuff has priority … 😉  
Thanks and have a good day  
Pepito

---

<div class="post-metadata">

**Author:** ![kisvegabor](http://forum.squareline.io/user_avatar/forum.squareline.io/kisvegabor/32/537_2.png) [@kisvegabor](http://forum.squareline.io/u/kisvegabor)\
**Post date:** [October 3, 2022, 8:51am UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/8 "2022-10-03T08:51:10Z")

</div>

Please enable [logging](https://docs.lvgl.io/master/porting/log.html) to see id LVGL has some errors or warnings. I think it’s an out-of-memory issue.

---

<div class="post-metadata">

**Author:** ![mike.stephenson](http://forum.squareline.io/letter_avatar_proxy/v4/letter/m/b5e925/32.png) [@mike.stephenson](http://forum.squareline.io/u/mike.stephenson)\
**Post date:** [November 2, 2022, 2:24am UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/9 "2022-11-02T02:24:26Z")

</div>

Can you happen to post your simple example? I’m just starting with Squareline & WT32-SC01 and it would be a tremendous help to have something to start with. I will appreciate anything you can provide.

Mike

---

<div class="post-metadata">

**Author:** ![pepito](http://forum.squareline.io/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pepito](http://forum.squareline.io/u/pepito)\
**Post date:** [November 2, 2022, 9:01am UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/10 "2022-11-02T09:01:17Z")

</div>

Hi Mike,

I’m currently not at home.

It works fine with that board.

With touch.

Going to send you my template.

Then generate only your specific ui files.

Do not update / overwrite the template.

Check libraries, often there ist some stuff missing, e.g. for touch.

Have a good day

Peter

---

<div class="post-metadata">

**Author:** ![pepito](http://forum.squareline.io/letter_avatar_proxy/v4/letter/p/22d042/32.png) [@pepito](http://forum.squareline.io/u/pepito)\
**Post date:** [November 2, 2022, 12:00pm UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/11 "2022-11-02T12:00:48Z")

</div>

here is the tmplate.ino:  
#include “lvgl.h”  
#include “ui.h”  
#define LGFX\_USE\_V1  
#include \<LovyanGFX.hpp\>  
#include \<FT6236.h\>  
#define SDA\_FT6236 18  
#define SCL\_FT6236 19  
FT6236 ts = FT6236();

public:  
LGFX(void)  
{  
{ //  
auto cfg = \_bus\_instance.config(); //  
cfg.spi\_host = VSPI\_HOST; // (VSPI\_HOST or HSPI\_HOST)  
cfg.spi\_mode = 0; // SPI(0 ~ 3)  
cfg.freq\_write = 40000000; //  
cfg.freq\_read = 16000000; //  
cfg.spi\_3wire = false; // MOSI true  
cfg.use\_lock = true; //  
cfg.dma\_channel = 1; // Set the DMA channel (1 or 2. 0=disable)  
cfg.pin\_sclk = 14; // SPIのSCLK  
cfg.pin\_mosi = 13; // SPIのMOSI  
cfg.pin\_miso = 12; // SPIのMISO  
cfg.pin\_dc = 21; // SPIのD/C (-1 = disable)  
\_bus\_instance.config(cfg); //  
\_panel\_instance.setBus(&\_bus\_instance); //  
}

```
{ //
  auto cfg = _panel_instance.config(); // 
  cfg.pin_cs = 15; // CS(-1 = disable)
  cfg.pin_rst = 22; // RST(-1 = disable)
  cfg.pin_busy = -1; // BUSY(-1 = disable)
  cfg.memory_width = 320; // 
  cfg.memory_height = 480; //
  cfg.panel_width = 320; //
  cfg.panel_height = 480; //
  cfg.offset_x = 0; //
  cfg.offset_y = 0; //
  cfg.offset_rotation = 0; //
  cfg.dummy_read_pixel = 8; //
  cfg.dummy_read_bits = 1; //
  cfg.readable = true; //
  cfg.invert = false; //
  cfg.rgb_order = false; //
  cfg.dlen_16bit = false; //
  cfg.bus_shared = true; //

  _panel_instance.config(cfg);
}

{ //
  auto cfg = _light_instance.config(); //

  cfg.pin_bl = 23; //
  cfg.invert = false; // true
  cfg.freq = 44100; //
  cfg.pwm_channel = 7; //

  _light_instance.config(cfg);
  _panel_instance.setLight(&_light_instance); //
}

setPanel(&_panel_instance); //

```

}  
};

LGFX tft;

static const uint32\_t screenWidth = 480;  
static const uint32\_t screenHeight = 320;  
static lv\_disp\_draw\_buf\_t draw\_buf;  
static lv\_color\_t buf[screenWidth \* 10];

/\* Display flushing \*/  
void my\_disp\_flush( lv\_disp\_drv\_t \*disp, const lv\_area\_t \*area, lv\_color\_t \*color\_p )  
{  
uint32\_t w = ( area-\>x2 - area-\>x1 + 1 );  
uint32\_t h = ( area-\>y2 - area-\>y1 + 1 );

tft.startWrite();  
tft.setAddrWindow( area-\>x1, area-\>y1, w, h );  
// tft.pushColors( ( uint16\_t \* )&color\_p-\>full, w \* h, true );  
tft.writePixels((lgfx::rgb565\_t \*)&color\_p-\>full, w \* h);  
tft.endWrite();

lv\_disp\_flush\_ready( disp );  
}

void my\_touchpad\_read( lv\_indev\_drv\_t \* indev\_driver, lv\_indev\_data\_t \* data )  
{  
if(ts.touched())  
{  
data-\>state = LV\_INDEV\_STATE\_PR;  
TS\_Point p = ts.getPoint();  
data-\>point.x = p.y;  
data-\>point.y = tft.height() - p.x;  
// Serial.print( "Data x " );  
// Serial.println( data-\>point.x );

// Serial.print( "Data y " );  
// Serial.println( data-\>point.y );  
}  
else  
{  
data-\>state = LV\_INDEV\_STATE\_REL;  
}  
}

void setup()  
{  
Serial.begin(115200);

tft.begin();  
tft.setRotation(1);  
tft.setBrightness(255); // works fine

if(!ts.begin(40, SDA\_FT6236, SCL\_FT6236)){  
Serial.println(“Unable to start the capacitive touch Screen.”);  
}

lv\_init();  
Serial.println(“lv\_init done”);  
lv\_disp\_draw\_buf\_init( &draw\_buf, buf, NULL, screenWidth \* 10 );

/_Initialize the display_/  
static lv\_disp\_drv\_t disp\_drv;  
lv\_disp\_drv\_init(&disp\_drv);  
Serial.println(“Display Init done”);  
/_Change the following line to your display resolution_/  
disp\_drv.hor\_res = screenWidth;  
disp\_drv.ver\_res = screenHeight;  
disp\_drv.flush\_cb = my\_disp\_flush;  
disp\_drv.draw\_buf = &draw\_buf;  
lv\_disp\_drv\_register(&disp\_drv);  
Serial.println(“Set Display Properties done”);  
/_Initialize the (dummy) input device driver_/  
static lv\_indev\_drv\_t indev\_drv;  
lv\_indev\_drv\_init(&indev\_drv);  
indev\_drv.type = LV\_INDEV\_TYPE\_POINTER;  
indev\_drv.read\_cb = my\_touchpad\_read;  
lv\_indev\_drv\_register(&indev\_drv);  
Serial.println(“Set Dummy Input Device done”);  
ui\_init();  
Serial.println(“ui\_init() done”);  
// tft.fillScreen(TFT\_YELLOW);  
}

void loop()  
{  
lv\_timer\_handler(); /\* let the GUI do its work \*/  
delay( 5 );  
}

one level up …/libraries/ you need the following in it:

 ![grafik](http://forum.squareline.io/uploads/default/original/1X/dd23ce41972acf7bfa76a6a04d59cc911f8e5c57.png)

---

<div class="post-metadata">

**Author:** ![mike.stephenson](http://forum.squareline.io/letter_avatar_proxy/v4/letter/m/b5e925/32.png) [@mike.stephenson](http://forum.squareline.io/u/mike.stephenson)\
**Post date:** [November 3, 2022, 2:02am UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/12 "2022-11-03T02:02:57Z")

</div>

Thank you! I really appreciate it. I’m sure this is going to save me a lot of time!

Mike

---

<div class="post-metadata">

**Author:** ![sukeshak](http://forum.squareline.io/user_avatar/forum.squareline.io/sukeshak/32/264_2.png) [@sukeshak](http://forum.squareline.io/u/sukeshak)\
**Post date:** [November 4, 2022, 5:28am UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/13 "2022-11-04T05:28:15Z")

</div>

Please go to this URL and select the firmware and flash it.  
You only need a Browser and a USB cable.  
[https://iot.sukesh.me](https://iot.sukesh.me)

Arduino sample is here

> **[GitHub - sukesh-ak/LVGL8-WT32-SC01-Arduino: ESP32 + WT32-SC01 + LOVYANGFX +...](https://github.com/sukesh-ak/LVGL8-WT32-SC01-Arduino)**
>
> ESP32 + WT32-SC01 + LOVYANGFX + LVGL8 with Arduino - sukesh-ak/LVGL8-WT32-SC01-Arduino

Integration with SquareLine Studio coming soon.

---

<div class="post-metadata">

**Author:** ![rickyed](http://forum.squareline.io/letter_avatar_proxy/v4/letter/r/898d66/32.png) [@rickyed](http://forum.squareline.io/u/rickyed)\
**Post date:** [November 23, 2022, 9:24am UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/14 "2022-11-23T09:24:47Z")

</div>

hello

I also buy the wt32-sc01 plus  
on the other hand I want to upload the program from arduino IDE 2.0. is it possible.

because i am using esp32-dev module, with com port 12 on my pc.  
the arduino ide compiles the program but fails to flash the esp32

am I making a mistake?

I thank you

---

<div class="post-metadata">

**Author:** ![eried](http://forum.squareline.io/user_avatar/forum.squareline.io/eried/32/373_2.png) [@eried](http://forum.squareline.io/u/eried)\
**Post date:** [January 24, 2023, 12:02pm UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/15 "2023-01-24T12:02:18Z")

</div>

I found this: [GitHub - FCam1/SC01\_Plus\_HMI\_example: Arduino example using SquareLine Studio to make an HMI with an SC01\_plus capacitive display.](https://github.com/FCam1/SC01_Plus_HMI_example)

It works perfect on my SC01 Plus. I just copy the files from squareline after exporting them

---

<div class="post-metadata">

**Author:** ![Neptuno0](http://forum.squareline.io/letter_avatar_proxy/v4/letter/n/e5b9ba/32.png) [@Neptuno0](http://forum.squareline.io/u/Neptuno0)\
**Post date:** [February 12, 2023, 12:56am UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/16 "2023-02-12T00:56:56Z")

</div>

Hi there, please, I need a very, very simple example of configuration for the touchscreeen using squareline and wt32-sc01 (not plus), and no tux please… tux is the only place where the sc01+lvgl+touch is mention, but is a bit complex, just need a simple working example, I finally got the images from squareline to upload but was not, so far, able to use the touch.  
I have tried adding lovyan but with no luck.  
it is hard to believe, but I could not find a simple example for this board like a simple on/off touch button using squareline.  
the example in the tux page using only the touchscreen without lvgl is great and works, but I’d like to add the nicer looking from squareline.

thank you very much

---

<div class="post-metadata">

**Author:** ![kisvegabor](http://forum.squareline.io/user_avatar/forum.squareline.io/kisvegabor/32/537_2.png) [@kisvegabor](http://forum.squareline.io/u/kisvegabor)\
**Post date:** [February 13, 2023, 2:29pm UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/17 "2023-02-13T14:29:13Z")

</div>

Can you link the driver which work without LVGL?

Making an already working driver work with LVGL is quite simple. See [here](https://docs.lvgl.io/8/porting/indev.html#touchpad-mouse-or-any-pointer).

---

<div class="post-metadata">

**Author:** ![Neptuno0](http://forum.squareline.io/letter_avatar_proxy/v4/letter/n/e5b9ba/32.png) [@Neptuno0](http://forum.squareline.io/u/Neptuno0)\
**Post date:** [February 18, 2023, 4:53pm UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/18 "2023-02-18T16:53:06Z")

</div>

Hi kisvegabor, I have looked before at that link, I did again but still can’t make it work.  
this example from the tux gitub works perfectly fine in my wt32-sc01, but i am missing something trying to add the code on the UI from squareline:

`
/*
    Simple Touch Drawing sample for WT32-SC01
*/
#define LGFX_AUTODETECT // Autodetect board
#define LGFX_USE_V1 // set to use new version of library
#include <LovyanGFX.hpp> // main library
static LGFX lcd; // declare display variable
// Variables for touch x,y
static int32_t x,y;
void setup(void)
{
Serial.begin(115200);
Serial.print(“ready”);
lcd.init();
// Setting display to landscape
if (lcd.width() < lcd.height()) lcd.setRotation(lcd.getRotation() ^ 1);
lcd.setCursor(0,0);
lcd.printf(“Ready to touch & draw!”);
}
void loop()
{
if (lcd.getTouch(&x, &y)) {
lcd.fillRect(x-2, y-2, 5, 5, TFT_RED);
lcd.setCursor(380,0);
lcd.printf(“Touch:(%03d,%03d)”, x,y);
Serial.printf(“Touch:(%03d,%03d)”, x,y);
Serial.println();
```
if (x > 200 && x < 300)
{
  if (y > 150 && y < 250)
  {
    lcd.setCursor(380, 300);
    lcd.print("GOT IT");
  }  
}

```
`

`}
}
`

---

<div class="post-metadata">

**Author:** ![kisvegabor](http://forum.squareline.io/user_avatar/forum.squareline.io/kisvegabor/32/537_2.png) [@kisvegabor](http://forum.squareline.io/u/kisvegabor)\
**Post date:** [February 21, 2023, 10:07am UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/19 "2023-02-21T10:07:29Z")

</div>

You need something like this:

```auto
void my_input_read(lv_indev_drv_t * drv, lv_indev_data_t*data)
{
   int32_t x,y;
   if (lcd.getTouch(&x, &y)) {
      data->point.x = x;
      data->point.y = y;
      data->state = LV_INDEV_STATE_PRESSED;
   } else {
      data->state = LV_INDEV_STATE_RELEASED; 
   }
}

```

```auto
static lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_input_read;
lv_indev_register(&indev_drv);

```

---

<div class="post-metadata">

**Author:** ![Neptuno0](http://forum.squareline.io/letter_avatar_proxy/v4/letter/n/e5b9ba/32.png) [@Neptuno0](http://forum.squareline.io/u/Neptuno0)\
**Post date:** [February 25, 2023, 8:31pm UTC](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428/20 "2023-02-25T20:31:04Z")

</div>

thanks again for the answer.  
I had tried like that before, but when I do, I get this errors:

In file included from

```auto
 c:\users\neptuno\documents\arduino\libraries\arduino_443962\src\lgfx\v1\platforms\common.hpp:22,
                 from C:\Users\Neptuno\Documents\Arduino\libraries\arduino_443962\src/lgfx/v1/platforms/esp32/Bus_SPI.hpp:51,
                 from C:\Users\Neptuno\Documents\Arduino\libraries\arduino_443962\src/lgfx/v1/platforms/device.hpp:50,
                 from C:\Users\Neptuno\Documents\Arduino\libraries\arduino_443962\src/lgfx/v1_init.hpp:22,
                 from C:\Users\Neptuno\Documents\Arduino\libraries\arduino_443962\src/LovyanGFX.hpp:31,
                 from C:\Users\Neptuno\Documents\Arduino\ui_test\ui_test.ino:8:
c:\users\neptuno\documents\arduino\libraries\arduino_443962\src\lgfx\v1\platforms\esp32/common.hpp:182:32: error: 'SeekMode' has not been declared
     bool seek(uint32_t offset, SeekMode mode) { return _fp->seek(offset, mode); }
                                ^ ~~~~~~~
c:\users\neptuno\documents\arduino\libraries\arduino_443962\src\lgfx\v1\platforms\esp32/common.hpp: In member function 'virtual void lgfx::v1::FileWrapper::skip(int32_t)':
c:\users\neptuno\documents\arduino\libraries\arduino_443962\src\lgfx\v1\platforms\esp32/common.hpp:180:55: error: 'SeekCur' was not declared in this scope
     void skip(int32_t offset) override { seek(offset, SeekCur); }
                                                       ^ ~~~~~~
c:\users\neptuno\documents\arduino\libraries\arduino_443962\src\lgfx\v1\platforms\esp32/common.hpp:180:55: note: suggested alternative:
In file included from C:\Users\Neptuno\Documents\Arduino\libraries\TFT_eSPI/Processors/TFT_eSPI_ESP32.h:137,
                 from C:\Users\Neptuno\Documents\Arduino\libraries\TFT_eSPI/TFT_eSPI.h:100,
                 from C:\Users\Neptuno\Documents\Arduino\ui_test\ui_test.ino:2:
C:\Users\Neptuno\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.6\libraries\FS\src/FS.h:43:5: note: 'SeekCur'
     SeekCur = 1,
     ^ ~~~~~~
In file included from c:\users\neptuno\documents\arduino\libraries\arduino_443962\src\lgfx\v1\platforms\common.hpp:22,
                 from C:\Users\Neptuno\Documents\Arduino\libraries\arduino_443962\src/lgfx/v1/platforms/esp32/Bus_SPI.hpp:51,
                 from C:\Users\Neptuno\Documents\Arduino\libraries\arduino_443962\src/lgfx/v1/platforms/device.hpp:50,
                 from C:\Users\Neptuno\Documents\Arduino\libraries\arduino_443962\src/lgfx/v1_init.hpp:22,
                 from C:\Users\Neptuno\Documents\Arduino\libraries\arduino_443962\src/LovyanGFX.hpp:31,
                 from C:\Users\Neptuno\Documents\Arduino\ui_test\ui_test.ino:8:
c:\users\neptuno\documents\arduino\libraries\arduino_443962\src\lgfx\v1\platforms\esp32/common.hpp: In member function 'virtual bool lgfx::v1::FileWrapper::seek(uint32_t)':
c:\users\neptuno\documents\arduino\libraries\arduino_443962\src\lgfx\v1\platforms\esp32/common.hpp:181:63: error: 'SeekSet' was not declared in this scope
     bool seek(uint32_t offset) override { return seek(offset, SeekSet); }
                                                               ^ ~~~~~~
c:\users\neptuno\documents\arduino\libraries\arduino_443962\src\lgfx\v1\platforms\esp32/common.hpp:181:63: note: suggested alternative:
In file included from C:\Users\Neptuno\Documents\Arduino\libraries\TFT_eSPI/Processors/TFT_eSPI_ESP32.h:137,
                 from C:\Users\Neptuno\Documents\Arduino\libraries\TFT_eSPI/TFT_eSPI.h:100,
                 from C:\Users\Neptuno\Documents\Arduino\ui_test\ui_test.ino:2:
C:\Users\Neptuno\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.6\libraries\FS\src/FS.h:42:5: note: 'SeekSet'
     SeekSet = 0,
     ^ ~~~~~~
In file included from c:\users\neptuno\documents\arduino\libraries\arduino_443962\src\lgfx\v1\platforms\common.hpp:22,
                 from C:\Users\Neptuno\Documents\Arduino\libraries\arduino_443962\src/lgfx/v1/platforms/esp32/Bus_SPI.hpp:51,
                 from C:\Users\Neptuno\Documents\Arduino\libraries\arduino_443962\src/lgfx/v1/platforms/device.hpp:50,
                 from C:\Users\Neptuno\Documents\Arduino\libraries\arduino_443962\src/lgfx/v1_init.hpp:22,
                 from C:\Users\Neptuno\Documents\Arduino\libraries\arduino_443962\src/LovyanGFX.hpp:31,
                 from C:\Users\Neptuno\Documents\Arduino\ui_test\ui_test.ino:8:
c:\users\neptuno\documents\arduino\libraries\arduino_443962\src\lgfx\v1\platforms\esp32/common.hpp: In member function 'bool lgfx::v1::FileWrapper::seek(uint32_t, int)':
c:\users\neptuno\documents\arduino\libraries\arduino_443962\src\lgfx\v1\platforms\esp32/common.hpp:182:74: error: invalid conversion from 'int' to 'fs::SeekMode' [-fpermissive]
     bool seek(uint32_t offset, SeekMode mode) { return _fp->seek(offset, mode); }
                                                                          ^~~~
In file included from C:\Users\Neptuno\Documents\Arduino\libraries\TFT_eSPI/Processors/TFT_eSPI_ESP32.h:137,
                 from C:\Users\Neptuno\Documents\Arduino\libraries\TFT_eSPI/TFT_eSPI.h:100,
                 from C:\Users\Neptuno\Documents\Arduino\ui_test\ui_test.ino:2:
C:\Users\Neptuno\AppData\Local\Arduino15\packages\esp32\hardware\esp32\2.0.6\libraries\FS\src/FS.h:66:38: note: initializing argument 2 of 'bool fs::File::seek(uint32_t, fs::SeekMode)'
     bool seek(uint32_t pos, SeekMode mode);
                             ~~~~~~~~~^~~~
exit status 1
Error compiling for board ESP32 Wrover Kit (all versions).

```

and this is my ui.ino:

```auto
#include <lvgl.h>
#include <TFT_eSPI.h>
#include "ui.h"

#define LGFX_AUTODETECT // Autodetect board
#define LGFX_USE_V1 // set to use new version of library

#include <LovyanGFX.hpp> // main library

static LGFX lcd; // declare display variable

// Variables for touch x,y
static int32_t x,y;

/*If you want to use the LVGL examples,
  make sure to install the lv_examples Arduino library
  and uncomment the following line.
#include <lv_examples.h>
*/

/*Change to your screen resolution*/
static const uint16_t screenWidth = 480;
static const uint16_t screenHeight = 320;

static lv_disp_draw_buf_t draw_buf;
static lv_color_t buf[screenWidth * screenHeight / 10];

TFT_eSPI tft = TFT_eSPI(screenWidth, screenHeight); /* TFT instance */

#if LV_USE_LOG != 0
/* Serial debugging */
void my_print(const char * buf)
{
    Serial.printf(buf);
    Serial.flush();
}
#endif

/* Display flushing */
void my_disp_flush( lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p )
{
    uint32_t w = ( area->x2 - area->x1 + 1 );
    uint32_t h = ( area->y2 - area->y1 + 1 );

    tft.startWrite();
    tft.setAddrWindow( area->x1, area->y1, w, h );
    tft.pushColors( ( uint16_t * )&color_p->full, w * h, true );
    tft.endWrite();

    lv_disp_flush_ready( disp );
}

/*Read the touchpad*/
void my_touchpad_read( lv_indev_drv_t * indev_driver, lv_indev_data_t * data )
{
   int32_t x,y;
   if (lcd.getTouch(&x, &y)) {
      data->point.x = x;
      data->point.y = y;
      data->state = LV_INDEV_STATE_PRESSED;
   } else {
      data->state = LV_INDEV_STATE_RELEASED; 
   }
}

void setup()
{
    Serial.begin( 115200 ); /* prepare for possible serial debug */

    String LVGL_Arduino = "Hello Arduino! ";
    LVGL_Arduino += String('V') + lv_version_major() + "." + lv_version_minor() + "." + lv_version_patch();

    Serial.println( LVGL_Arduino );
    Serial.println( "I am LVGL_Arduino" );

    lv_init();

#if LV_USE_LOG != 0
    lv_log_register_print_cb( my_print ); /* register print function for debugging */
#endif

    tft.begin(); /* TFT init */
    tft.setRotation( 3 ); /* Landscape orientation, flipped */

    lv_disp_draw_buf_init( &draw_buf, buf, NULL, screenWidth * screenHeight / 10 );

    /*Initialize the display*/
    static lv_disp_drv_t disp_drv;
    lv_disp_drv_init( &disp_drv );
    /*Change the following line to your display resolution*/
    disp_drv.hor_res = screenWidth;
    disp_drv.ver_res = screenHeight;
    disp_drv.flush_cb = my_disp_flush;
    disp_drv.draw_buf = &draw_buf;
    lv_disp_drv_register( &disp_drv );

    /*Initialize the (dummy) input device driver*/
    static lv_indev_drv_t indev_drv;
    lv_indev_drv_init( &indev_drv );
    indev_drv.type = LV_INDEV_TYPE_POINTER;
    indev_drv.read_cb = my_touchpad_read;
    lv_indev_drv_register( &indev_drv );

    ui_init();

    Serial.println( "Setup done" );
}

void loop()
{
    lv_timer_handler(); /* let the GUI do its work */
    delay(5);
}
```

[Next page](http://forum.squareline.io/t/esp32-wt32-sc01-problems-getting-started/428.md?page=2)
