0

This question already has an answer here:

I'm writing a "sketch" in the Arduino IDE which has at this very moment 1500 lines and is going to become much longer. I splitted it in several tabs, but that's not very comfortable to use (I need to find the "precompiler" file in a temporary folder in order to have my program in a printable version, in the tabs bar I can't see all tabs, ...).

Are there any better alernatives to the Arduino IDE? Someone suggested me PlatformIO, is that a good IDE? (please note that I have a mac running OS X 10.12.1; I also have a (virtual) Windows 10 machine if absolutly needed, but I'd like to install the IDE on MAC OS X)

What are the best ways to create a long program? In general, for C++, what are the best practices? And is for Arduino the same?

marked as duplicate by jfpoilpret, Dat Ha, rebatoma, KIIV, Nick Gammon Jan 2 '17 at 5:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • In the arduino IDE you can set the option "use external editor". Then you can use your own favorite editor, like Notepad++ or Sublime Text. You will then only use the Arduino IDE for compiling and uploading. – Gerben Dec 14 '16 at 13:01
  • 1
    Instead of keeping all the 1500 lines in a single .ino, why not creating your own library with its .cpp and .h files ? It is quite easy when reading that "Arduino Libraries - Manual installation". – J. Piquard Dec 14 '16 at 15:41
0

Give a try to Platformio. It's based on the Atom editor. It's great and multi platform (mac, windoze, linux)

As for splitting your program, it is a good idea but not any ways. Keep concepts in the same file, avoid using globals are just a few hints.

1

Have you tried Atmel Studio? Right now, it only supports Windows but is a great alternative to Arduino IDE.

If you're not comfortable using Windows virtual machine, I suggest you have a look at this: http://playground.arduino.cc/code/eclipse

0

@Maximus suggested Atmel Studio. WHile this choice is not bad, the programming language, well at least if you are used to the "Arduino type" C, is different then Arduino. An easy way to get all of the things you are used with Arduino to an other IDE is Visual Micro.

This IDE is deffenetly an upgrade. It has code completition and is just more adapted for programming (thats in my opinion). A good thing that I like about it is that it will still pass by the Arduino IDE's compiler.

BTW, you'll need to have Visual Studio.

0

I can't help but recommend UECIDE, but then I wrote it. It's better than the Arduino IDE at working with large projects with multiple files, yet not as complex as things like Atmel Studio.

I would, however, recommend a re-think about how you arrange your project. A single long file (even if made from multiple files joined together) isn't good. Instead you should split your project into a number of modules. Consider writing libraries for some of the functionality of your program.

No one in the real world wants a massive program as one single file. All big projects are made out of multiple files, and those files are all separate units and compiled separately. The fact that the Arduino IDE joins them all together into one gargantufile is IMHO a bad idea. Keep things separate. Keep things modular. Keep things as they are in the real world of development.

  • Yes, I personally experienced that a single file isn't good at all. What would be a good way to create separate units? Is the creation of libraries the only way to do that? – noearchimede Dec 14 '16 at 15:08
  • The creation of libraries is a good way to do it, though editing them can be more difficult than using the IDE. It's easier in UECIDE since you can have libraries embedded within your sketch and edit them in the IDE. Just making C++ instead of INO files (.cpp instead of .ino) in the normal Arduino IDE keeps things separate too. – Majenko Dec 14 '16 at 16:36

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