Pages: [1] 2   Go Down
Author Topic: In what IDE do you write libraries for Arduino?  (Read 3511 times)
0 Members and 1 Guest are viewing this topic.
London
Offline Offline
Sr. Member
****
Karma: 1
Posts: 268
Arduino has it all
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 602
Posts: 33371
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Belgium
Offline Offline
Edison Member
*
Karma: 68
Posts: 1899
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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 -

London
Offline Offline
Sr. Member
****
Karma: 1
Posts: 268
Arduino has it all
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

nr Bundaberg, Australia
Offline Offline
Tesla Member
***
Karma: 126
Posts: 8472
Scattered showers my arse -- Noah, 2348BC.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley
______
Rob
Logged

Rob Gray aka the GRAYnomad www.robgray.com

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 212
Posts: 13531
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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.



Logged

Rob Tillaart

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

Dallas, Texas
Offline Offline
Sr. Member
****
Karma: 3
Posts: 267
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 124
Posts: 6647
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Belgium
Offline Offline
Edison Member
*
Karma: 68
Posts: 1899
Arduino rocks; but with my plugin it can fly rocking the world ;-)
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well if we start mentioning product ...
I like my eclipse plugin. But I'm probably biased  smiley-cool
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

Logged

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 -

Dallas, Texas
Offline Offline
Sr. Member
****
Karma: 3
Posts: 267
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
export EDITOR="$(which emacsclient) -n -c"
export VISUAL=$EDITOR
export EMACSCLIENT=$EDITOR
export ALTERNATE_EDITOR="$EDITOR -a nano"
alias edit=$ALTERNATE_EDITOR
Logged


Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@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) ?
Logged

Dallas, Texas
Offline Offline
Sr. Member
****
Karma: 3
Posts: 267
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@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. smiley-wink 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.
Logged


Offline Offline
Edison Member
*
Karma: 26
Posts: 1339
You do some programming to solve a problem, and some to solve it in a particular language. (CC2)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Dallas, Texas
Offline Offline
Sr. Member
****
Karma: 3
Posts: 267
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Excellent. If you edit may files, I'm sure you'll quickly wonder how you ever worked without it.
Logged


Pages: [1] 2   Go Up
Jump to: