📜 ⬆️ ⬇️

A pair of crutches for Notepad ++ Arduino IDE (for Dummies)



If you work with Arduino, then sooner or later you will always be disappointed in the minimalist functionality of the Arduino IDE as in a text editor code. Neither human backlighting, nor autocompletion, nor tasty buns and plug-ins ... And naturally you will begin to dig information about Arduino bundles with Intellij Idea, Sublime Text, or, at worst, with Notepad ++, since even in the latter, editing the code is much more comfortable.

That's just about the last bundle of Arduino with Notepad ++ and it will be a tale about crutches, for those who have not yet forked up the Intellij Idea or Sublime Text license.
And in general, by working with a sketch in Notepad ++, you can minimize access to the Arduino IDE window (the first and well-known crutch) or even completely eliminate the launch of the Arduino IDE and compile and even upload the sketch to the board directly from Notepad ++ (the second crutch).

')

Crutch first


It is not even a crutch, but such a build-in cane, nominally available in the Arduino IDE. But using it, judging by the forums, is practically none. Although, if you look, you can live with it for some time ...
  1. So, the sequence of actions is as follows:
  2. launch the Arduino IDE;
  3. open your sketch;
  4. go to the IDE settings and enable the "Use external editor" checkbox;

    Now the IDE window has changed color and the ability to edit the sketch in the IDE itself has disappeared.

  5. open Notepad ++ (or any other code editor or other favorite IDE);
  6. open your sketch, connected modules, libraries, etc .;
  7. edit the code;
  8. save;
  9. go to the Arduino IDE;
  10. click Verify or Upload (compile or unload the sketch);

What's going on? When the “Use external editor” checkbox is enabled, the Arduino IDE will automatically re-open the current sketch that you saved in another editor for each Verify or Upload operation. Well, in general, it's not manna from heaven, but you can already live with it, and not suffer from the inferiority of the Arduino IDE editor.

What is wrong? What you need to switch between windows ... it quickly tires. It would be desirable, as in childhood, as in humans! - edited the code, pressed Alt + F9 for Compile, then Ctrl + F9 for Run. There is such a solution.

Crutch second


And this is a full-fledged walker, with rubber caps and foam handles. But, the design is still sovok, without candelabra ...

Starting with version 1.5 (this is the one with the support of Arduino Due ) The Arduino IDE began to support work from the command line. Full list of commands can be found here . We will be interested in two commands, "--verify" and "--upload" to compile and unload the sketch, respectively.

To use them, you need to install the NppExec plugin in Notepad ++. This can be done from the plugin menu. For more information about installing and using the plugin, see the corresponding article on Habré . We will be especially interested in the file level environment variable $ (FULL_CURRENT_PATH), which inserts a full line of files in the current tab of Notepad ++ on the command line.

Now we need to create two macros for verify and upload commands in NppExec. But before that you need to add the path to the system variable PATH, where the arduino.exe file is located (the path to the Arduino IDE installation folder). This is so that our macros start with a short “arduino -”, and not with an indication of the full path to the executable file. How to change the PATH for different operating systems described here .

Now we create two macros:

Note that the variable "$ (FULL_CURRENT_PATH)" should be specified in quotes, this is in case the path to the sketch file contains spaces.
And if you do not specify any parameters in the macros for the board, chip, port, etc., then all these parameters for uploading to the board (macro --upload) will be taken from those that were configured in the Arduino IDE at the last launch.

In the NppExec settings menu there is an option that places the macros you create on the Macros tab on the Notepad ++ menu bar.
image

Unfortunately, the NppExec developer did not take care of the option of creating new buttons on the Notepad ++ panel and linking new macros to them, so our macros will have to be run from the Macros menu:
image
New macros will be located at the bottom of the menu, under the separator.

Now you can open the console (“Show Console Dialog”)
image
and check the macros.

All messages of the Arduino IDE will now be displayed on the Notepad ++ console itself when compiled and unloaded.
But there is an underwater rock. If you are sitting on Russian Windows, then instead of Russian system messages of the C compiler and Russian letters in the file path (for example, if you keep your sketches in the Google Drive folder), you will see abracadabra in the NppExec console. While this is not systematically treated (I have not yet addressed the NppExec developer), but you can try replacing the current NppExec library with one of the two proposed in the latest release, ANSI or Unicode . I have not helped yet ...

As you can see, this crutch has a couple of unpleasant flaws.


First, arduino.exe is launched each time the macro is run and closes upon its execution. Thus, you lose 3-4 seconds for each compilation of the code. In this regard, the Arduino IDE is slightly faster. But, if you write the code carefully and rarely compile, then this should not strain you.

Secondly, as I wrote above, the NppExec developer did not take care of the option of creating new buttons on the Notepad ++ panel with new macros attached to them, as done, for example, in the Python Script plugin:
image
(the picture is clickable)
Therefore, the macros will have to run in two mouse clicks, for example from the Macros menu.

Thirdly, you do not have monitor COM-port in Notepad ++. But here nobody will help you, accept ... the monitor is only in the Arduino IDE. But for me, for example, for debugging a new library for WiFly, it was not always necessary, only when monitoring the operation of an already enabled and spilled board with a module. And almost all the work I did (and now I saw) in Notepad + +.

I, in general, reconciled with this. And even some intrigue remained - to finish the buttons and the monitor yourself.

Well, now it remains to assign the Alt + F9 and Ctrl + F9 hotkeys to the new macros.
image
and…
image
Welcome home, oldies! ;)
And no Arduino IDE.

PS Not all pictures are taken from my Notepad ++, litter. I'm not at my computer now, but I was very much asked to share crutches. Then I will replace the pictures with real ones.
The topic a la turbo pascal can be viewed here .

Source: https://habr.com/ru/post/236213/


All Articles