Alternate IDE (Part 2)
Well Notepad++ is really my editor of choice for coding Arduino. Although I am aware of many other powerful editors, I like the style as well as the price (It is free!). Anyway, I felt like Notepad++ was lacking something handy available elsewhere: running external applications. As my first attempts to use the run (f5) command were not successful and because I am not patient… I left the question aside and kept coding tap tap tap tap tap tap tap etc.
However, having started with new languages, I felt like I should solve this problem. Surprisingly, few posts describe the solution well enough to be understood and run snappy, except this one which was the starting point for this post. Here is an attempt to make it in few minutes.
Firstly, have Notepad++ and Arduino installed.
WARNING: Due to a regression this will not work with Arduino rev. 6.1.2 ! Use rev. 6.1.1 or the latest rev. 6.8.1 instead.
Install NppExec (a plugin for Notepad++) from the (Plugins Menu).
Open an Arduino sketch in Notepad++. Then press the f6 key from your keyboard and this form will show:
Enter the following code in the Commands text box:
// set full path to arduino debug set arduino_path = "C:\Program Files (x86)\arduino\rev. 1.6.11\arduino_debug" // save current sketch file npp_save // gets com port value inputbox "Enter the COM port of your Arduino (e.g., COM1):" // verify, uploads to the specified port cmd /c $(arduino_path) --port $(input) --upload $(full_current_path)
Note: Change the path to Arduino according to your own configuration
Save the script using any name you like and press OK.
The script prompts you for the serial com port to which your arduino board is connected.
Note: You may want to run Arduino before doing that in order to set all default parameters such as the com port and the board type.
Enter the com port:
Click OK and here we go …
The console pops at the bottom of Notepad++ and shows the instructions and their results:
SET: arduino_path = "C:\Program Files (x86)\arduino\rev. 1.6.11\arduino-1.6.11\arduino_debug" $(ARDUINO_PATH) = "C:\Program Files (x86)\arduino\rev. 1.6.11\arduino-1.6.11\arduino_debug" NPP_SAVE: C:\Users\dlongueville\Documents\Arduino\projects\projects_pending\Blink\Blink.ino INPUTBOX: "Please enter the COM port of your Arduino (e.g., COM3):" $(INPUT) = COM3 $(INPUT) = COM3 cmd /c "C:\Program Files (x86)\arduino\rev. 1.6.11\arduino-1.6.11\arduino_debug" --port COM3 --upload C:\Users\dlongueville\Documents\Arduino\projects\projects_pending\Blink\Blink.ino Process started >>> Loading configuration... Initializing packages... Preparing boards... Verifying and uploading... Sketch uses 940 bytes (2%) of program storage space. Maximum is 32,256 bytes. Global variables use 9 bytes (0%) of dynamic memory, leaving 2,039 bytes for local variables. Maximum is 2,048 bytes. <<< Process finished. (Exit code 0) ================ READY ================
If you want to customize your own sketch, pay a visit to the ARDUINO(1) Manual Page in order to get all possible arguments.
How do I stop a script ? Press f6 again and press the Terminate button
How can I run the default script without opening the editor form ? Press Ctrl + f6
Is it possible to close the console on completion of uploads ? Yes, append the “npp_console 0” line to the script