I’m having a lot of frustration using Platformio as used in the “Build Webservers” lessons. Straight off when adding the files supplied with the lessons, I get errors (squiggly underlines) relating to the libraries required. indicating a problem with being able to read the files. If I go to the library manager and try to download the files to the project, which sometimes works, but doesn’t change the status in the main.ccp file. Obviously I don’t understand how this all works together. If I load the code that is in main.ccp into the Arduino IDE it compiles perfectly. What then is the advantage of PIO??
Hi.
Have you tried compiling the code?
Sometimes it doesn’t recognize the libraries at first. But then, after compiling the code, the red underlines disappear.
How are you creating your projects with PIO?
The libraries you are using should be referenced in the platformio.ini file.
If you download the project folders provided with the course and load them on VS Code, they will work straight away.
Did you follow all the instructions provided? What is the project that you are trying to run?
Regards,
Sara
Hi Sara,
To do the lesson (for example 2.5 of the “Build Webservers” lessons. I open a New Project from the Platformio home page. I then copy files downloaded from the lesson into their appropriate locations. IE main.cpp to SRC folder, index.html, style,css, favicon…etc to the data folder, and replace the platformio.ini file with the one in the lesson. It wouldn’t correctly compile stating that some files couldn’t be found. I assumed it was because the “squigglys” indicated a problem with the libraries. In this particular instance, in the wee hours I noticed that the copied include statement in mail.cpp for the webserver library looked like this #include . When I removed the spaces it worked. I went back to the link in the lesson book and redownloaded the folder with the lesson files and then it looked like this #include . These kind of tripping points are hard for a novice with any new dicipline, especially when there are so many complexities like platformio. Add to it the rapidly everchanging updates of libraries, (and the one that worked yesterday doesn’t work today) makes more issues. I think an aid to those of us who are trying to keep up is providing an “addendum” page to aid in lessons. I’ve seen in the lesson book; references to including spiffs in the include statements after being mentioned in earlier lessons that spiffs has been deprecated. A great example of the need for an addendum.
Other issues with platformio I personally have had are I’m sure strictly my understanding (or lack thereof) platformio. For example I can create a new project, then when attempting to install a library, when it asks to select a project, the one I just created doesn’t show in the list. I still don’t know what that’s all about but I usually leave Vcode, delete the created folder, and start over, hoping to see it. Sometimes I do, sometimes not. I’m sure it’s something I’m doing but I don’t know what. There are other frustrations with Platformio, but I’m sure you get the idea. I like the concept of Platformio, with all files in one editor, but what a learning curve…..phew.
Hi again.
I’m sorry for those issues.
I’ve just done the procedure you’ve described, and everything worked straight away without any issues. You get the red underlines when you copy the code to the main.cpp file. But, once you update the platformio.ini file, those errors should go away without having to do anything else.
As for the SPIFFS issue, SPIFFS is deprecated for the ESP8266. Not for the ESP32. We still use SPIFFS for the ESP32 because it works just fine. Additionally, LittleFS was not incorporated for the ESP32 in the official arduino core.
As for including the libraries, you must be doing something wrong. We provide two different ways to include libraries in the eBook – see page 41. The easiest way is to copy the library identifier to the platformio.ini file – see page 44.
You can always open the complete project folder in VS Code without having to change or create any files. See page 169 to learn how to open a project folder.
Nonetheless, I understand that VS Code with PlatformIO might be difficult to get used to and may take some time until you understand how it works. That’s why we also provide instructions if you want to use Arduino IDE.
However, if you feel like you won’t be able to follow the projects, you can always ask for a refund https://randomnerdtutorials.com/returns-and-refunds/
Regards,
Sara