Example code in the eBook “Learn LVGL GUIs for ESP32 Projects” shows the expression touchscreen.begin(touchscreenSPI); in the setup() routine. This flags up as an error in PlatformIO stating “too many arguments in function call”. Removing touchscreenSPI from within the brackets solves the problem.
Looking at the code within the “begin” function within the XPT2046_Touchscreen code, no argument is expected. Once the argument is removed from the expression, the code compiles and runs correctly.
I presume the example codes are in error?
Hi.
I don’t know.
It works just fine in Arduino IDE.
Maybe you have a different version of the library in PlatformIO?
Regards,
Sara
Hi Sara,
Thanks for coming back on this.
Looks like PlatformIO is using the previous release (1.3) to what Arduino IDE (1.4) is using. The newer version allows for multiple display objects, hence the availability of the touchscreen.begin(touchscreenSPI) statement. Both versions work fine with touchscreen.begin().
Regards,
Geoff
Great.
I’ll mark this issue as resolved. If you need further help, you just need to open a new question in our forum.
Regards,
Sara
For the benefit of PlatformIO users who may want to take advantage of the newer version of the XPT2046 library, simply replace the current statement in the platformio.ini file (paulstoffregen/XPT2046_Touchscreen@0.0.0-alpha+sha.26b691b2c8) with PaulStoffregen/XPT2046_Touchscreen: Touchscreen Arduino Library for XPT2046 Touch Controller Chip
This will then match the version in use by the modules within the ebook
Geoff