Single click build with Visual Studio Code and Visual Teensy?

zapta

Well-known member
I am using Teensy 4.0 with Visual Source Code and a Visual Teensy generated project with the Arduino builder and everything works just great (I am new to VSC and am very impressed).

My question is, how do I configure it to build and upload using a single click? Currently I click Command Pallete.. | Tasks: run build tasks | Build (arduino), and this builds and uploads.

The left hand edge of VSC has a Run section but I am not sure how to configure it to build and run.

Thanks.
 
The VSC menu is named a bit unusual. You'd not use the Run menu but the Terminal menu. So, Terminal | Run Build Task | Upload (XXX) where XXX is the uploader you prefer. (Teensy.exe, TyCommander or TeensyCLI). The upload entries first build and then upload. However, I only use the keyboard shortcut CTRL + SHIFT + B which brings you directly to the Run Build Task menu. Since VSC remembers the last action it usually takes just a CTRL+SHIFT+B followed by ENTER to recompile ad upload.

Here a video showing the process: https://www.youtube.com/watch?v=UyrZ7ogx67Q

I recommend to at least try to do builds without the Arduino builder. It gives you much more control over the build process and a readable compiler output.
 
Have a look at platform.io. It can be used with Visual Studio Code and has one-click build and upload buttons.
 
@luni, I am using arduino builder to make sure other people can build. It's an open source project and VSC is not required.

@mstiller, I presume that platform.io provides an extension. I am looking for a solution that doesn't require writing an extension.

I found on the internet something that works by adding a keybinding file in the project. Ctrl-b now builds the probject and uploads the binary to the Teensy 4. I would love to also have an icon that executes it but didn't find a good solution yet.

https://github.com/zapta/stepper_analyzer/blob/master/arduino/.vscode/keybindings.json
 
@luni, I am using arduino builder to make sure other people can build. It's an open source project and VSC is not required.
Fair point. Good thing is that there is no hidden stuff or extensions installed by VisualTeensy which basically makes you independent of third party software.

I found on the internet something that works by adding a keybinding file in the project. Ctrl-b now builds the probject and uploads the binary to the Teensy 4. I would love to also have an icon that executes it but didn't find a good solution yet.
I don't quite understand? This just replaces CTRL+SHIFT+B by CTRL+B? Is this worth it?

I just tried this: https://marketplace.visualstudio.com/items?itemName=actboy168.tasks. This is a zero conf extension. All it does is to add all tasks it finds to the status bar where you can start them by a single click:

Anmerkung 2020-07-24 171004.jpg
 
@luni, thanks for the Tasks pointer, I will check it up.

The ctl-shift-b used to open a menu with a few build options, it didn't actually run anything by itself. That's was my experience.
 
Perfect, have fun with VisualTeensy and let me know if something doesn't work as expected.
 
Perfect, have fun with VisualTeensy and let me know if something doesn't work as expected.

Are you the author of VisualTeensy, it was godsend for me and I was impressed with the cleanness of the UI to the point I added to my TODO to look at the code and see what frameworks and techniques it uses.

As for the vscode, I just stumbled upon it a week ago and wow! it's fun to use, and makes me much more productive than with the Arduino IDE.
 
Are you the author of VisualTeensy, it was godsend for me and I was impressed with the cleanness of the UI to the point I added to my TODO to look at the code and see what frameworks and techniques it uses.
Yes I'm the author, glad you like it. It is a standard c#/wpf app, nothing special at all from the coding point of view.

As for the vscode, I just stumbled upon it a week ago and wow! it's fun to use, and makes me much more productive than with the Arduino IDE.

Agreed, the Arduino IDE is great for beginners allowing them to setup a project in no time. But, if you are used to state of the art development systems it feels like a flash back to the last century where you had to work without code completion, jump to symbol definitions/declarations, seeing errors while you type, having grayed out "un-#def'ed" code sections and all the rest. vscode and the accompanying c/c++ extension are doing a fantastic job in increasing productivity indeed.

Other than other solutions, I decided to do something which doesn't bind the user code to it. Therefore, VisualTeensy just generates some project scope config settings for vscode and a makefile. It is not involved at all in editing, building or uploading. Once the project is set up it doesn't need VisualTeensy anymore. Actually, it doesn't even need vscode. If you want, you can simply open some shell (cmd, powershell...), type 'make all' from the project folder and the project will build and upload.

Here a quick WIKI if someone is interested in details: https://github.com/luni64/VisualTeensy/wiki
 
Back
Top