Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 10 of 10

Thread: Single click build with Visual Studio Code and Visual Teensy?

  1. #1

    Single click build with Visual Studio Code and Visual Teensy?

    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.

  2. #2
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,068
    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.

  3. #3
    Member
    Join Date
    Apr 2020
    Location
    Germany, NRW
    Posts
    86
    Have a look at platform.io. It can be used with Visual Studio Code and has one-click build and upload buttons.

  4. #4
    @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_ana...ybindings.json

  5. #5
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,068
    Quote Originally Posted by zapta View Post
    @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.

    Quote Originally Posted by zapta View Post
    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...ctboy168.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:

    Click image for larger version. 

Name:	Anmerkung 2020-07-24 171004.jpg 
Views:	19 
Size:	89.6 KB 
ID:	21111

  6. #6
    @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.

  7. #7
    @luni, the Tasks extension works very well. Exactly what I was looking for. Thanks.

  8. #8
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,068
    Perfect, have fun with VisualTeensy and let me know if something doesn't work as expected.

  9. #9
    Quote Originally Posted by luni View Post
    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.

  10. #10
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,068
    Quote Originally Posted by zapta View Post
    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.

    Quote Originally Posted by zapta View Post
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •