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 —

11 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

  4. Just stumbled on this site and blog. Great series, thanks. I’m not a novice but this series of blogs is surely a good help for those who get started with the Arduino.

    One remark about N++ as an IDE to make things even a bit more handy: You can add the Arduino IDE under the Run command by adding a shortcut there for the Arduino IDE. Make sure you set the same key stroke sequence for the Windows shortcut (like on your desktop) as well, of course.

    Next time you make a sketch from scratch (or a text paste from the web) and hit the Run command, it will open it in the Arduino IDE.

    Like

      • Got it!
        Step 1. Click Run command or hit F5
        Step 2. Fill in the following command line in de dialog box: “C:\Program Files (x86)\Arduino\arduino.exe” “$(FULL_CURRENT_PATH)”. The path foir the Arduino executabel may vary on your system.
        Step 3. Test it.
        Step 4. Open Run once again. The command shopuld be still ther. Now click Save first in the dialog and fill in you shortcut key strokes and click ok when done.
        Step 5. It should now be on the Run menu.

        Like

Leave a comment