Fun with Arduino 28 Use an External Editor like Notepad++

When writing more code than just a few lines, it might be worthwhile to invest a little bit of time to to start using a more capable editor than the one integrated in the Arduino IDE. There are several free editors around that have a wealth of features that make code editing more efficient and more pleasurable.

Read on below the video …

A nice thing of the Arduino IDE is that it allows us to choose if we want to use an external editor. This can be enabled via the menu file > preferences by setting the tick mark with Use external editor.

external_editor

The editing area is greyed out now, telling us that we can’t type here anymore, we need to make changes via another editor. Once we save the file in that other editor, the Arduino IDE automatically refreshes its content and we can upload and test our changes without the need to re-open a file, or to copy / paste anything.

If you’d Google, quite a few editors can be found. The ones that I use are Notepad++ (on the left in the picture below, click to enlarge) and Visual Studio Code (on the right). Both are free editors.

NotepadVisual_Code

Of these two, Notepad++ has the shortest learning curve … actually none at all. After install it is ready for use straight away. Only when we like to use the more advanced features we will have to find out how. It is worthwhile to visit the menu settings > preferences and adjust the settings to your liking.

Code_CompletionWhat are the benefits? Besides code highlighting, one of the nice features is ‘code completion’. When we start typing, a popup window shows the instructions, functions and variables that start with the first characters we typed. We can select the one we need, or we can keep typing. This is quite efficient, and it also helps to not make typo’s.

To use code completion for Arduino in Notepad++, the Arduino language plugin has to be installed. The video shows how.

Beware that for use with Arduino, when you save a file in Notepad++  the file must be saved inside a folder with the same name as the .ino file … it’s just how the Arduino IDE works.

Visual Studio Code takes a bit more effort to get started. If you like to give it a try, Google some to find tutorials how to set it up for use with Arduino.

Have fun editing.

— 0 —

Advertisements

8 thoughts on “Fun with Arduino 28 Use an External Editor like Notepad++

  1. Hi, what will be the advantages of using Visual Studio Code instead of Notepad++?
    Thanks for your awesome blog!
    Regards, Alex.

    Like

    • Not too much, it’s just a matter of taste. One of the advantages is that the code can be run directly from VSC, (although still the Arduino IDE is required to be installed on your PC).

      Like

  2. Hi. On the download page for the Arduino Plugin there are 2 screenshots. The one on the left show the syntax for pinMode. How do I open up for that feature ?

    Like

    • Strange !! Auto-Completion works ok but the syntax for the command, that I type, don’t show up !! I must look the video one more time 🙂

      Like

  3. Yes, sometimes strange effects happen. With me it works perfect on one laptop, it only works half (only shows commands that are already used in the code) on another.

    Like

    • Yes same thing here, it only shows commands that are already used in the code !! (Running Win 10 64Bit) Will try another Pc.

      Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s