I have just installed VS code and Platformio on Windows 10. I followed the instructions on docs https://docs.platformio.org/en/latest/integration/ide/vscode.html#ide-vscode-toolbar to create and run the simple UNO blink program.
However I cannot compile or run the task as the toolbar does not show the build and upload icons. I think this is because the platformio.ini file is not present in the root folder (where I believe it should be created as part of the “new project” wizard?
After running the wizard, my folder structure contains two files, a sub folder called src containing a file called main.cpp…
root folder
v src
main.cpp
This is book one, page one stuff. But I can’t make any progress. What am I missing?
That shouldn’t happen. Does the Help → Toggle Developer Tools → Console show some error messages?
Thank you for your suggestion maxgerhardt. Here’s what I get from …
I hope you can see something useful in there…
Doesn’t look like any error is in there.
Open a PlatformIO CLI in VSCode and execute pio init -b uno --ide=vscode
. Does it generate the folders and the platformio.ini now?
OK Max, I tried the pio init, but failed miserably. There’s got to be something fundamentally wrong here.
As soon as I clicked on “PlatformIO Core CLI”, the “failed to create process” message was displayed and then the same again after I tried the pio init command.
Anyway here’s a screen dump …
Well that’s not good. Maybe it has problems with the apostrophe in your username?
Can you try a PlatformIO core reinstall by closing VSCode, deleting C:\Users\Peter's Workshop\.platformio
and reopening VSCode?
CC @ivankravets possible path problems
Thanks for your ongoing help Max. This is what I got after deleting .platformio. I tried the init command again…
pio
commands only work in the PlatformIO CLI where the the PlatformIO core path was added to the PATH
environment variable, if it failed to open that terminal, a regular terminal won’t do.
You might be able to add C:\Users\<user>\.platformio\penv\Scripts
to the Windows path though.
OK I added a new path C:\Users\NewUser\.platformio\penv\Scripts
What should I try next?
Does this output anything different now?
Sorry Max, I fear I may not have followed your instructions properly? I’m not sure how the new path is to be used? Anyway, same result.
You did add the path via Add to the PATH on Windows 10 | Architect Ryan and then restarted VScode? Otherwise the change won’t apply.
Yeah I actually edited/added to the wrong path. Now I’ved added the path according to Architect Ryan, but unfortunately I still get the same result. “Failed to create process”.
I presume <‘user’> has to exist on the C drive? It doesn’t.
Do I have to add a new user account to my PC?
That was a hint to substitute your username there, so Peter's Workshop
.
LOL, what a goose! I have now edited the new path with my username and restarted vscode, but got exactly the same result.
Is it possible that you could create a new Windows user with no special characters and no spaces, switch to that user, install VSCode + PlatformIO extension again and retry project creation?
Well Max, that worked! New user account with no apostrophe and no spaces in the path.
A bunch of folders including platformio.ini were created and the blink program compiled, uploaded and ran properly. Just like the documentation describes.
I think I’ll create another user account with apostrophes and spaces in the file path, just to test this more thoroughly. But its time for bed now…
Thanks for your help. I’ll post my results. Of course any other tests you’d suggest to get this working on my “real” user account are welcome.
Test results…
I created three new win10 user accounts.
-
One with no spaces and special characters in the Windows path,
-
One which included an apostrophe and,
-
One which included spaces in the path
In all cases I installed vscode and platformio. And in all cases I used the new project wizard and sucessfully created, compiled, uploaded and ran the UNOBlink task.
So there is no issue with spaces and special characters in the path for PlatformIO.
Clearly however, there’s some compatibility issue with platformio and something in my real user account that is preventing the creation of the various folders and files under the project root directory.
What could this be? Are there any known issues that I should check out?
Is there some kind of logging within PlatformIO that I should enable to check for error messages?
Was your original test project in a OneDrive folder? I’ve seen horrible things happen when attempting to develop inside OneDrive folders. You can try to move the project folder and reopen it in VSCode.
Otherwise, Please login to your real user account, open a windows terminal (Windows + R → cmd.exe
) and execute
mkdir temp
cd temp
mkdir test_proj
cd test_proj
"C:\Users\Peter's Workshop\.platformio\penv\Scripts\pio.exe" init -b uno --ide=vscode
No my original test project was on the local machine.
Here’s the result of the cmd.exe test…