IDE question

Hello,

I've been programming (everything from assembler to C++) since the 80s. I've used a lot of development systems.

Question: In the Arduino IDE, how does one trace a constant back to the source file? The headers are shown but there's no way to open them up other than searching for the file directly. What happened is that an example didn't compile because a constant was undef. Trying to trace where this is in the appropriate include file is extremely difficult. Am I missing something? Using Arduino 1.04 with the 4wd robot kit (with my son). Is there a more capable IDE that people are using for Arduino projects?

Thanks

Am I missing something?

Probably reading the two bolded sticky topics at the top of this programming section.

I read the stickies but must have missed the answer. Is there a reason the answer can't be posted in a response to my question or is this a treasure hunt?

Vasi: Hello,

I've been programming (everything from assembler to C++) since the 80s. I've used a lot of development systems.

Question: In the Arduino IDE, how does one trace a constant back to the source file? The headers are shown but there's no way to open them up other than searching for the file directly. What happened is that an example didn't compile because a constant was undef. Trying to trace where this is in the appropriate include file is extremely difficult. Am I missing something? Using Arduino 1.04 with the 4wd robot kit (with my son). Is there a more capable IDE that people are using for Arduino projects?

Thanks

IDE is designed to be minimalistic so not to confuse people with six different windows and three layers of menus. However, all the libraries are in one of two places, so they're easy to find with any text editor if you need to.

There's an arduino plugin for eclipse, and I almost exclusively use a Makefile. Search around for a one you like, but sudar's works pretty well for me with few modifications.

Of course, if you're developing on windows, your options become more limited.

Thanks Wiz!

Yeah, I'm on Windows and tried MariaMole but there's no drill down. I'll check out Eclipse.

Cheers

Is there a reason the answer can't be posted in a response to my question or is this a treasure hunt?

So, you read the part about posting your code, and decided that that didn't apply to you. And then you decide to berate people that are trying to help. Well, that's not the best approach, I can assure you.

Vasi: What happened is that an example didn't compile because a constant was undef.

What constant?

Read this before posting a programming question

However if this is a general question, so you can solve future problems of this nature, I recommend a text editor with "find in files" ability, eg. Crimson Editor on Windows. Then just point it at the Arduino IDE directory tree and search away.

Personally I've written a scanner that reads the entire directory tree into a SQLite3 database with the FTS option (full text search) and then use that to do stuff like:

find F_CPU NEAR BAUD_RATE

Which gives a satisfyingly small number of results:

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Search term: F_CPU NEAR BAUD_RATE

Desktop\arduino-1.0.3\hardware\arduino\bootloaders\atmega8\ATmegaBOOT.c
 ... F_CPU/(BAUD_RATE*16L)-1);
  //UBRRH = (F_CPU ... 

Desktop\arduino-1.0.3\hardware\arduino\bootloaders\atmega\ATmegaBOOT_168.c
 ... F_CPU/(BAUD_RATE*16L)-1);
                UBRR0H = (F_CPU/(BAUD_RATE ... 

Desktop\arduino-1.0.3\hardware\arduino\bootloaders\bt\ATmegaBOOT_168.c
 ... F_CPU/(BAUD_RATE*16L)-1);
        UBRR0H = (F_CPU/(BAUD_RATE ... 

Desktop\arduino-1.0.3\hardware\arduino\bootloaders\lilypad\src\ATmegaBOOT.c
 ... F_CPU/(BAUD_RATE*16L)-1);
        UBRR0H = (F_CPU/(BAUD_RATE ... 

Desktop\arduino-1.0.3\hardware\arduino\bootloaders\optiboot\optiboot.c
 ... UBRRL = (uint8_t)( (F_CPU + BAUD_RATE * 4L) / (BAUD_RATE * 8L ... 

Matched 5 file(s) (Search term: F_CPU NEAR BAUD_RATE)
578 files searched.
-------------------------------------------------------------------------------

Thanks Nick.

I programmed microcontrollers for years back in the 80s and 90s and the development environments were actually better than the Arduino IDE. I realize I can search and eventually figure out where everything is but I was hoping the system would help with that a lot more than it does. You should be able to right-click on any function, header, constant, etc. and go directly to where it’s defined. I think Arduino is doing students a disservice by making this cumbersome (sorry for the rant but I was trying to teach my son and the level of unnecessary frustration is quite high). I haven’t done hardcore programming for over a decade but I’m amazed at how little it’s progressed as evidenced in the Arduino IDE system.

Vasi: I programmed microcontrollers for years back in the 80s and 90s and the development environments were actually better than the Arduino IDE.

The arduino IDE is the only IDE I have ever seen or used where I did not have to read a tutorial about how to use it. It's also open source and simple enough you can understand the code and fix issues or see why something happens the way it does. Having more features does not necessarily make something better.

If you are proficient enough to know how to use other IDEs it should be simple for you to figure out how to add the arduino libraries and upload code.

The lack of some fundamental things like:

  • Replace-all in a selection
  • Find-and-replace with regular expressions
  • Find in files
  • Go to line number

... is frustrating, but as WizenedEE says, at least you don't waste a lot of time learning the system.

And you are allowed to use external editors if you want, there is a checkbox for that.