5

How can I create a workspace & projects so that either the Arduino IDE or the EclipseArduino IDE may be used to develop the project, interchangeably?

I have both IDEs installed and working but in separate workspaces.

I need:

  • One workspace that either IDE can understand and work in;
  • Either to IDE build with the physically same set of library sources;
  • Whichever IDE I open to see my sources as I last left them, regardless of which IDE I last used.

I want:

  • The source files to have conventional names - .C or .C++, not .pde or .ino;
  • Either IDE to build with the physically same set of library object modules;

My use-case is that I work in/with Eclipse, and I teach Arduino skills to people starting out with the Arduino IDE. I'd like to be able to prepare class work at home with Eclipse but open and project it in class with the Arduino IDE. It would be nice if I could demonstrate the two IDEs using the same code. Clearly, I could hack up a demonstration, but I'd rather do it honestly and without sync issues like having to apply twice any changes we made in class.


Update 20 Apr '16: At @Jantje's suggestion (in the comments below his answer), I created a github issue, "Importing an ArduinoIDE project with the New Sketch Wizard and using same sketch-name, failed." The new sketch would over-write the .ino file with a new, empty sketch.

That issue got fixed in the April 14, 2016 nightly and now works as his answer to this question says it does.

JRobert
  • 15,407
  • 3
  • 24
  • 51

2 Answers2

2

Are you willing / able to work with Xcode? There is a package called embedXcode that enables Arduino development on Macs – I'm just getting up to speed with it, but it does appear to allow you to work either in Xcode or with the Arduino IDE (the .ino file is present and is what you edit in Xcode). In my testing so far it appears that the easiest thing to do is to create a project using Xcode and then you can point the Arduino IDE at the project pretty easily, getting Xcode to pick up a sketch started in the Arduino IDE is currently beyond me.

From the point of view of your students I would think that you'd want to keep the .ino file rather than make them learn about the conventions of C or C++. It would also save you the hassle of somehow managing file names – although you could probably get make to do this for you.

I haven't looked into it at all, but I think you could do something similar with Atom (a quick Google found a blog post called Arduino Development in Atom Editor and an Atom package called nino that is described as a "Toolbelt for Arduino") or Emacs, or for that matter Vim is also like to have some Arduino support.

dlu
  • 1,661
  • 2
  • 15
  • 29
2

Your requirements for not having .ino files and wanting to be able to work with the Arduino IDE are conflicting. Assume we drop that requirement it is very much possible to do what you want.

The Arduino Eclipse plugin has been supporting .ino files for a long time now. You can simply compile Arduino IDE-made sketches. You do not have to make links and so make the folder where your Arduino IDE makes its sketches the workspace in Eclipse.

In Eclipse, for each sketch you want to edit, start the new sketch wizard and use a project name that is the same as the sketch name in the Arduino IDE.

Now you can work in the Arduino Eclipse plugin and the Arduino IDE on the same files.

Important: In Windows, if you use a version of the plugin from before March 3, 2016, you need to delete the .ino.cpp file before starting the Arduino IDE. In Linux, the Arduino IDE ignores this file, but in 1.6.7 on Windows (just tested it) the file gets picked up by the Arduino IDE. You need to restart the Arduino IDE to tell it the file is gone.

From March 3, 2016 onwards, the code in the .ino.cpp file is inside a #ifdef that is not defined in Arduino IDE.

dda
  • 1,595
  • 1
  • 12
  • 17
jantje
  • 1,392
  • 1
  • 8
  • 16