1

This is my first question in this website. I had recently got an arduino uno and did quite a few programs on it. Now, I had always used VS Code to do my C projects. So, I'm wondering if it possible to use VS Code to program an arduino, but without the arduino plugin available in VS Code. This might sound a bit weird but wanted to learn how to build those type of plugins from scatch. If you know any resources from where I could learn to do that, it would be very helpful. I searched through google but couldn't find any answers. Thank you in advance

New contributor
Samuel R is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
2
  • 1
    I wonder how did you search if you didn't find platformio?
    – Juraj
    12 hours ago
  • Install extension Arduino by Microsoft. its very simple to configure and use. for larger projects i would recommend platformio, BTW did you try new Arduino IDE2? if not give it a try, its much better than before.
    – sairfan
    1 hour ago

2 Answers 2

1

This might not be the answer you are looking for, but maybe it helps you and others. Besides, it's too long to write as a comment.

  1. Use VS Code only as editor

Make sure that your .ino file is as small as possible, typically, just enough to call a second file (.cpp or .c file). The idea is that you do not need to change the .ino file often as you need to load the .ino file only in your Arduino IDE. All other files (including the .ino) you load in VS Code.

Than you edit your files in VS Code as asual, but you compile/upload the file with the default Arduino IDE. The Arduino IDE doesn't see files being saved as new, so that's why you need not to change the .ino file often, as you need to synchronize it manually.

  1. MS Visual Studio

I'm using MS Visual Studio, comparable to VS Code and written stubs or even emulations for certain Arduino classes (like Arduino, but also for other libraries I use on the Arduino, which mimic or at least print something when called).

This way I can fully compile an Arduino project, and most important, run it so I can check the business logic and some parts of the hardware logic on a normal PC having a decent debugger etc. When working, I can use the first solution to upload it to an Arduino.

Writing these stubs is quite some work and the simulation can depend on the project (like for a LED strip project I actually visualized the LEDs on a PC).

4

If you really looking for an alternate for Arduino IDE. Than I will recommends you to go with platformio. It has great library management.

Just install the platformio extensions on the vs code and you are ready to go.

Your Answer

Samuel R is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.