IRQ - no connection
DO to ESP32 MISO
DIN to ESP32 MOSI
CS to a pin of your choice, make sure you define this pin in the library setup file
CLK to ESP32 SCK
Ah, I suppose that is the danger of trying to answer such a brief question.
No point in looking for an alternative to LittlevGL, there is none better. I assume you have the slider example in LittlevGL running and the touch screen working...
All you need to do now is take time to read the excellent online LittlevGL tutorial (example button code is on page 1!).
Use the LittlevGL reference documents to understand what each line in the slider example "setup" tab of the existing slider sketch does. All graphical elements follow the same coding approach.
With a bit of effort you will be able to very quickly generate screens like this one that I made to control some Neopixel LEDs:
The example author redraws the screen pixel by pixel in a loop, fortunately the TFT_eSPI library has efficient functions so the redraw speed is very good. This code change will speed up redraw but a RPi display may not cope as the interface design is sensitive to SPI clock rate and the pixel rate...:
I am not sure why you are so insistent that it is one button. It is much easier to have two buttons. one for "off" and one for "on" as screens with touch capability have plenty of room for two buttons. The urgency of request also suggests you have an exam assignment...
If you use two buttons then you do not need more complex de-bounce code.
The LittlevGL library provides some help with a toggle action, but I chose the simple path of having two buttons where "noisy" touch signals can be ignored.
The problem for me is that if I write the code for you then you will not have learnt anything and it will propagate more questions. The LittlevGL Arduino library is quite young and I see the developers do intent to add more examples so if you are patient then you may find an adaptable example included in the library.
Yes you are 200% right but I don't know what you know but you also don't know many things what I know.
So its no good to underestimate anyone like this. I was just asking you an example of a toggle button for touch screen which I don't know how to do that .
I could buy a ready made touch controller,that is not an issue.its just a learning purpose buy you treat like I'm asking you everything you have.
Couldn't agree more with Bodmer, i've just built an interface using the fantastic LittlevGL and it is very straightforward.
Start with the provided ESP32 example, add in some example code from here - https://docs.littlevgl.com/en/html/object-types/btn.html, tweak it with some help from https://forum.littlevgl.com/ and you'll be flying!
As I explained earlier,I just wanted to learn and see a toggle button on a tft display. I know what I'm doing and which system is good for me.
And now I managed it myself.so this matter is closed now.i don't need any suggestion for this topic anymore Thanks.
okay i was using a ili9341 display with 320x240 resolution and 2.4 inches. i can't get anything running. i have uncommented out the pins and commented the esp8266 values. i added the tft_espi library to arduino via zip file. do i need to update the contents of the zip file and how would i do that. any help would be appreciated from someone that has got a similar config working
First off. Run all the library examples. Note any problems on paper.
Your wiring looks fine for the TFT.
The Touch Screen will only work if you connect the T_CLK, T_CS, T_DIN, T_OUT pins.
You must have an XPT2046 chip mounted on the pcb at position U2.
Report any problems to the Forum. Quoting the example by name and typing from your paper notes.
Then run the Touch examples. Note any problems on paper.
Specify a GPIO pin for T_CS. The other pins go to the same SPI pins as the TFT.
Life is easier if you use exactly the same wiring as in the examples.
Report any problems to the Forum. Quoting the example by name and typing from your paper notes.
I have corrected the colour names. Your Green wire seems to be connected to D27 and not D21 from the Fritzing PNG. I have not checked the module pin numbers against Fritzing.
#define TFT_CS 15 // orange Chip select control pin
#define TFT_RST 4 // white Reset pin (could connect to RST pin) // # define TFT_RST -1 // Set TFT_RST to -1 if display RESET is connected to ESP32 board RST
#define TFT_DC 2 // gray Data Command control pin
#define TFT_MOSI 23 // purple
#define TFT_SCLK 18 // yellow
// LED
#define TFT_MISO 19 /// blue
// ** Touchscreen **
#define TOUCH_CLK 18 // yellow
#define TOUCH_CS 21 // green Chip select pin (T_CS) of touch screen
#define TOUCH_DIN 23 // purple
#define TOUCH_DO 19 /// blue
I would move the Green wire to D21 which "looks like next to" the Blue wire.
The Touch sketch should work.
Thanks for links and the Fritzing diagram. Especially annotating the wire colours in defines.
Much better than typing !!