I am using VSCode to write some code for my arduino and have what is probably a relatively dumb question...
How do I change the main sketch file?
As in, when you first open the program and hit the "verify" or "upload" button, it gives you a text box to select which file you want to work with. But I want to upload a different file now but am not sure how to change which one the IDE is working with.
The only way I am able to work around this without completely restarting the program is to rename the previous file to "[filename].h" or some other extension that cannot upload to an arduino board and only then it gives me the option to select the main sketch file again.
Thanks, learning a new IDE can be frustrating sometimes >:(
That really sounds like dumb question, maybe you don't describe your problem properly?
Write your code and save it once, then try to upload it to the board of your choice???
It is like any other text editor, so use it like one.
I'm having the same problem as the OP. Instead verifying and uploading the sketch in the active tab (like the Arduino IDE does), the VSCode Arduino extension is operating on whatever file is referred to in a line of .vscode/arduino.json constructed as "sketch": "examples/01.Basics/Blink.ino". The only way I have found to verify or upload a different sketch is to edit or delete the arduino.json file.
I'm running VSCode on Linux Mint 19 Cinnamon 64-bit, using the Microsoft Arduino extension. Here are some of the steps of how the problem happens:
1) Delete the .vscode/arduino.json file in my Arduino workspace to start fresh
2) Open VSCode
3) Open an arduino sketch (sketch A)
4) Select board and serial port
5) Click on "verify" -- a message pops up asking me to "Select the main sketch file", with an unorganized dropdown menu of every single sketch that is in any of the workspace folders.
6) I select the filename of sketch A, designating a "main sketch file", and it verifies the sketch
7) Open another sketch (sketch B)
8 ) Click on "verify"
PROBLEM: VSCode verifies sketch A, but I want it to verify sketch B.
I can't figure out how to tell VSCode that I want to verify the sketch I am editing, rather than the one I first selected. The dropdown list does not even appear a second time.
Other than editing the json file, does anyone know how to select a different sketch?