I had changed my mind about posting – thought it would be only a complaint without any resolution. But it got submitted without my knowing (the fumble finger syndrome, I guess). Well, maybe I am missing something. So here goes: I’m following your book “Build Web Servers …”. Sorry for the length of this.
I’m used to developing complex projects incrementally. I go so far to find something that works then save it. I add more that works and do a “Save As” and add maybe a “_1” to the file name. I may have many sketches like that before I get a sketch I give a version and rev number -V1R1. I save all of these sketches.
Here is the thing: It is so, so easy with the Auduino IDE. Make a sketch, do a “Save As”, and go on coding. No additional work. No additional time. No creating a new project for each program. No configuration file. Don’t even have to identify the board and port.
My computer file system provides the means to have a tailored organization of folders and files as fits each particular project of mine. The structure can be quite deep and contains all files and sketches related to the project. For example, I needed to measure the wheel RPM, of my self balancing robot, I wrote a short sketch to do that . It is included along with all the sketches and files for the project.
Compared to this PlatformIO seems to have a very flat hierarchical structure. To me the workspace should be the overall project. And, you should be able to add more workspaces – which I could not find a way to. Under the workspaces, where you now have Project, you should be able to have any number of sub-projects (like my sketches), each with their own src/main but with a common platformio.ini. That would make sense.
Right now, unless, I am missing some serious information, I don’t think I can work anyway like I do with the Arduino IDE. The solution to me may be the Arduino 2.0, which has many of the features found in PlatformIO. I have been working with it successfully.
Thanks for sharing your thoughts.
Yes, I think you’re right. Taking into account your working method, using Arduino IDE is easier and faster and avoids having a lot of files created on your computer.
When using PlatformIO, each sketch corresponds to a project folder that needs to have all those files and the platformio.ini file to include libraries and other configurations.
I usually use Arduino IDE for small/simple sketches and PlatformIO for something a little bit more complex.
I agree wasted enough time on PlatformIO. Worked with a few IDE programming platforms and wasted
lot of time on this one. Arduino IDE coming back.
I made a quick read of your book “Build Web Servers with the ESP32 and ESP8266” several weeks ago …
Now I’m reading slowly the book again with the goal of running the different examples in ESP32
With the ESP32 from AZ-Delivery you can choose the framework espressif or Arduino. But with the Adafruit feather ESP32 you can use only Arduino framework
Can you share an explanation? or I’m wrong …
I have a folder labeled “useful_code”, and in that folder are examples of things I refer to in later projects, in the form of .cpp, .css, .html, and/or .js files. (example: simpleSlider.cpp, simpleSlider.css, simpleSlider.html and/or simpleSlider.js). When I do a new project, having started one in PlatformIO, I open the needed file from that useful_code folder, and then copy/paste appropriate parts into the project’s main.cpp, for example. Personally, I don’t like Arduino’s flat structure (each file is a new separate window). I’m probably used to product development IDEs which have the structure of PlatformIO, so the separate “useful_code” folder is the way I solve my problem of needing tidbits of code.
I guess it’s the way way you are use to working and your working environment. I came to coding as a hobbyist so I am not governed by any discipline other than the need to be organized so I can find things in the future Over the years I have done over 60 projects in the Arduino IDE. I have 1547 sketches (the lack of discipline) n my Arudino folder and some in my Arduino 2 folder. Granted nearly all are intermediate sketches developed along the way – trials and errors, hits and misses, sketches to test new hardware added to a project, etc. Do I want to see them as one one vertical string of 1547 individual projects in a vertical line? I have been looking at the Platform IO forums and to see if I am missing some fundamental information. I have not been helped. What would be ideal would be if an overall project would be a workspace. And, if I could hide all work spaces other than the one I am working on.
I think the VS Code / PlatformIO IDE is more suited to team work where the entire file set is self-contained. However, you certainly can delete projects from a workspace (i.e. right-click on the project and select “remove folder from Workspace”), thus seeing only the project you’re working on … then pull in your other “example” projects when you need them (i.e. go to File/Add Folder to Workspace). Unlike Arduino IDE, you see all the projects in 1 screen and can easily cut/paste from any you chose to have displayed. … does this help?
Yes, you can organize your project folders inside a workspace.
To learn more about workspaces you can check this tutorial: https://randomnerdtutorials.com/vs-code-workspaces-esp32-esp8266/
Finally, I’m beginning to see the light as to how it works. Especially, thanks for the last post. I have been working through your Build Web Server Course using Arduno 2. Arduino 2, which has just come out of Beta has some of the features of Platform IO, auto complete, function methods (sometimes). I must upload files to the file system using original Arduio though. I’m Starting on Chapter 2.3 (Web Sockets), and will switch to PlatformIO to see the benefits.
Ok same with me came out off the Platform IO fog. What helped me was I used Arduio platform first for the
builds. Now I like the Platform IO and I will stick with it.
Sara, I took the plunge and did Chap 2.3 (Web Sockets – Build Web Server Course) on Platform IO. Manually inputted all code to get a feel of how it worked. Was quite impressed with the auto complete including reaching into the library and pulling up functions. Also appreciated error catching as I went along. The guide to function parameters was not helpful to me – aimed to the more experienced software person. Working on the next chapter now. Organizing the chapters under one multi workspace to keep them all together and I can call up all the chapters at the same time. Also makes coping elements from one project to another easier – like the favicon.png. I have questions but think I will make them separate posts
I have two questions related to pio command line operations.
1. I was well into the coding when I went to the platformio.ini and realized I selected the wrong board. I didn’t think simply typing the correct board into the file would work, but could not find a way within PlatformIO to fix it. An internet search brought up “pio init -b esp32dev” fixed the problem.
2. While working on the “Build Web Server” course I wanted to change the default folder in the Project Wizard for creating new projects related to the course. I could not find how to do that within PlatformIO. An internet search brought up a post by you, Sara. I learned I could do: “pio settings set projects dir D:\Platformio\RandomNerdsWebServerCourse”.
Where within PlatformIO do I find these commands? From a terminal window I did “pio -h” and “pio settings -h”, “pio settings set -h”, and a few more. Nothing got me to those commands.
Nothing in Help, Help/Documents, Help/ShowAllCommands that I could find useful
You can add the correct board in your platformio.ini file.
Those commands should be run in the PlatfomIO terminal window. Go to Terminal > New Terminal.
I successfully accomplished two actions: 1: changed board ( “pio init -b new board” ) 2: changed default project folder (pio settings set projects_dir new folder path).
The only way I knew how to do those two things was to go to the internet for answers. One of the answers was from you, Sara.. .
Question: How would I have found the same command line commands from within PlatformIO?
Here you can find a list with all commands: https://docs.platformio.org/en/latest/core/userguide/index.html#commands