I'm trying to learn from existing TFT_eSPI example Button.h
but the sketch won't compile. What am I doing wrong?
I just cant"C"it
Compilation error in TFT_eSPI_Button.h
void loop() {
// Check if the button is pressed
if (btn.contains(tft.getTouchX(), tft.getTouchY())) {
// Button is pressed, do something
tft.fillScreen(TFT_GREEN);
delay(500);
tft.fillScreen(TFT_BLACK);
btn.drawButton();
}
}
Compilation error: 'class TFT_eSPI' has no member named 'getTouchX'; did you mean 'getTouch'?
Thanks for your reply. I'm in the early stage of learning what the lines of "C" mean. I have no clue what's "class" or how to make the "working example" work.
Simple C tutorials don't start out with TFT libraries. Usually younstart out just printing stuff to the screen. Arduino basic examples start out with reading and writing physical IO pins.
I understand hardware. I setup my test esp32 with switches and LEDs. I programmed inputs and outputs. I have done that and also programmed LCD with touchscreen on Microchip PIC32 in MMBasic, I learned assembly language on IBM PC and I built website in HTML, but I just don't get C language. This is a good example of how impossible it is to find clear explanation of basically hidden code of a compiler.
None of those things teach you anything about the C++ language.
Point being, if you don't know what classes are in C++ then it will be hard to understand this. Despite how many other things you think you know, none of those things include how classes work in C++. So before you get too far along, it would probably hlp for you to learn about classes in C++.
I can't help but laugh at the level of disingenuousness when you follow
With this rant about how much you know. It doesn't matter what else you know. You don't know the thjng you need here. It is useless to tell me about your HTML skills. They don't apply here.
This is obviously a new topic for you. Treat it as one.
There is a clear explanation. You currently don't have the knowledge or vocabulary to understand it because classes are new to you. That isn't a fault with the explanation. That fault is in your understanding. To someone who knows how classes work this is trivial.
Yes, I'm fully aware that knowing the English language won't make you understand Spanish. The way I learned some programming was what was the standard at different times of microcontrollers evolution. Basic was acceptable language and had capability of in-line assembly for added execution speed. There was clearly explained documentation (some may remember Spontaneous Assembly or Peter Norton assembly for PC) and computers came with bunch of good books. Even HTML-4 was a great book. I wish, C and C++ examples were that clear. Whatever I read now on C language assumes you understand the language. Daah. If I unerstud, I wouldn't be reading it. I would be writing it.
It would not be crazy to pick up K&R C (the latest edition) and/or maybe the C++ Primer. It might feel like you're taking a long detour to getting your project working but everything is going to go so much faster if you understand the programming language!
I did the Hello World, I did Blink LED, I did switch inputs to light up LEDs on output, I solved some timing issues, done basic troubleshooting, but none of that started with clear learning steps. It just jumps from one topic to next.