Go Down

Topic: In what IDE do you write libraries for Arduino? (Read 4041 times) previous topic - next topic

DROBNJAK

I fancy writing some libraries for Arduino etc. but I do not know which IDEs are used to write and debug and compile the C++ code? Any advice?

How does one debug the C++ program that runs inside Arduino's Java IDE?

Grumpy_Mike

Same way as you debug normal arduino stuff, with prints an LEDs. I just use a text editor and I have the test program in the arduino IDE. Any error messages appere in the arduino IDE.

Jantje

Hi
When developing libraries it may be a good idea to understand what a Arduino library stands for.

In Arduino there is no difference between your sketch code and library code. All code is treated as standard code and linked as if it is one big program.
The only exception to the rule is the Arduino library code (the one you always need and use via arduino.h) which is actually build like a library.
The reason for this is that linking in a C library has the advantage of code optimizations (you don't need it you don't get it => smaller sketch).
However if you link in a library you need it; so code optimization is not (really) needed.
Best regards
Jantje
Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

DROBNJAK

that is surprise, I always thought that code inside Arduino's IDE is Java, not C++.

There is this library for computer vision, made for ArduPilot:

http://code.google.com/p/ardupilot-mega/source/browse/#git%2Flibraries%2FAP_OpticalFlow

For this Arduino Vision thingy:

http://code.google.com/p/ardupilot-mega/source/browse/#git%2Flibraries%2FAP_OpticalFlow

Unfortunately they made it compatible for ArduPilot, I do not now if it would work with Arduino. Does anybody fancy adjusting this library for Arduino and letting pure old Ard. get some eyesight.

Graynomad

The IDE is written in Java, but that has nothing to do with libraries written to run on an Arduino. The IDE is just another application, it could just as well have been written in VB.

Quote
Does anybody fancy adjusting this library for Arduino

Not me :)
______
Rob
Rob Gray aka the GRAYnomad www.robgray.com

robtillaart


I mostly write libraries in notepad++  while having a sample sketch to test the functionality in the IDE.

a tab for every .h and .cpp file makes switching a piece of cake.

in the FILE-> preferences menu you can also set /use an external editor for sketches, so the IDE is brought back to a compile and upload button.

For serial monitor I use putty.exe most of the time , recently played with br@y++ and that looks OK too.



Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

gerg

I normally use emacs for my IDE and screen for my serial monitor. If you're not using a build system of some type, you can then tell the arduino IDE, via preferences, that you're using an external editor. You can edit your file in your editor/IDE of choice and then hit the verify button, whereby it will reload and compile the file in the arduino IDE.
http://maniacalbits.blogspot.com

tuxduino

If the "library" is project- (i.e. sketch-) specific, the Arduino IDE can be conveniently used with multiple tabs.

westfw

Yea EMACS!  Me too.
Quote
tell the arduino IDE, via preferences, that you're using an external editor.

I find that this works really well, actually.  It's one of those really simple-to-implement "compromises" that looks a lot better in practice than when described; essentially it turns the Arduino IDE into a one-click compile/upload engine, and lets all the editing happen elsewhere.

Jantje

Well if we start mentioning product ...
I like my eclipse plugin. But I'm probably biased  8)
It is just that it provides me a single environment where I can easily do sketch and libraries compile and upload with nice features like bug marks, outline and jumps.

Best regards
Jantje

Do not PM me a question unless you are prepared to pay for consultancy.
Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -

gerg


Yea EMACS!  Me too.
Quote
tell the arduino IDE, via preferences, that you're using an external editor.

I find that this works really well, actually.  It's one of those really simple-to-implement "compromises" that looks a lot better in practice than when described; essentially it turns the Arduino IDE into a one-click compile/upload engine, and lets all the editing happen elsewhere.



Have you tried using daemon mode? A lot of emacians don't know about daemon mode. Use, "emacs --daemon" to start it up. Then use "emacsclient -n -c -a <alternate editor>". So for example, I use, "emacsclient -n -c -a nano". I then create an alias, in my case, "edit", for the emacsclient line. Then I can type, "edit <file>", and an emacs frame instantly pops up with <file>. The cool things is, emacs is now running as a server so all buffers you have previously opened/created are now accessible within your new frame. And, should I type, "edit" and had not previously started emacs, it will go ahead and edit the file via the specified alternate editor; in my case, nano.

And if you're on linux, you can use the following to pull things together.
Code: [Select]

export EDITOR="$(which emacsclient) -n -c"
export VISUAL=$EDITOR
export EMACSCLIENT=$EDITOR
export ALTERNATE_EDITOR="$EDITOR -a nano"
alias edit=$ALTERNATE_EDITOR

http://maniacalbits.blogspot.com

tuxduino

@greg

Wow, really cool! Unfortunately I'm not into emacs (I'm of the vim church :-) ) I obtain a (somewhat) similar result on ssh-administered machines with tmux (or screen). That emacs daemon mode seems more powerful, though. I wonder if vi has one too (or anything close) ?

gerg


@greg

Wow, really cool! Unfortunately I'm not into emacs (I'm of the vim church :-) ) I obtain a (somewhat) similar result on ssh-administered machines with tmux (or screen). That emacs daemon mode seems more powerful, though. I wonder if vi has one too (or anything close) ?


I've not heard of such a feature for vim. Doesn't mean it doesn't exist.

Of course, you can also try VIP, VIM, or VIPER mode for emacs. ;) Emacs nicely emulates a lot of vi/vim features and key bindings, allowing all but the most hard core vim user to find a home within emacs. I still use vi from time to time, normally as root. If I think about it, I'll use nano as root but muscle memory is vi for that quick edit. And that's one of the nice things about daemon mode is that its so fast, its comparable to using vi for that fast edit.

I will say, once you get used to daemon mode, you won't want to go back to your other work flows.
http://maniacalbits.blogspot.com

tuxduino

Looks like vim has it too... :-)

http://ajayfromiiit.wordpress.com/2009/10/21/server-and-client-mode-in-vim/

gerg

Excellent. If you edit may files, I'm sure you'll quickly wonder how you ever worked without it.
http://maniacalbits.blogspot.com

Go Up