3

I'm a newbie to Arduino so please excuse the easy question and guide me to the appropriate sources or forums. I just bought an Arduino Uno Starter Kit that comes with the "Arduino Projects Book" by Scott Fitzgerald et al and I'm happily working my way through the projects. I downloaded the Arduino IDE (version 1.7.10) onto my mac and am turning on lights, etc. However, I'd like to see the underlying code. For example, I use the code "digitalWrite" to turn off/on LEDs. I'd like to see the code for this. I can imagine that it's just a write of 1 or 0 to a particular memory address, but I'd still like to see it. I was hoping there was a right-click->"Go To Definition", but I don't see it. I downloaded the Arduino IDE to my Downloads folder and run it just from there. It's called Arduino.app. I don't see a folder with .c and .h files as suggested in this post: Arduino IDE, Underlying Code and Libraries Maybe I'm missing them?

Also, is it possible to set a breakpoint?

Again, sorry if these are "obvious" questions. And I did look at the Arduino site without any success.

Thanks,

Dave

1

The simplest way is to look at the source on Github:

Can you set a breakpoint? No. The Arduino IDE and the bootloader don't support such functionality. To do that you need a real IDE (like Atmel Studio) and a hardware debugger.

  • Thanks Majenko. Can you suggest (1) a way to pull all relevant files, and (2) how to search for a specific method. For example, how would one know which file to find "digitalWrite" in? The link you gives seems to list files in date order in which they have been last modified. Presumably, it would be better to just pull an entire directory structure with all files that went into making Arduino Studio version 1.7.10 Thanks – Dave Sep 26 '16 at 23:25
  • 1) use git. 2) use grep. Both from the command line. And no, they are listed alphabetically (case sensitive). – Majenko Sep 27 '16 at 9:46
  • Or alternative to 1), click the root of the repo, then download the zip. – Majenko Sep 27 '16 at 9:48
-1

Yes, they need a right-click->"Go To Definition"

Assuming the first appearance of a variable is the definition (variable declaration), use the following easily learnt "hack"..

Double click variable, then ^F, Esc, ^Home, ^G

..(where ^ = Ctrl).

  • what? In Arduino IDE? – Juraj Nov 16 '18 at 20:22
  • Yes Juraj. It is in reply to his I was hoping there was a right-click->"Go To Definition", but I don't see it. (where OP states which IDE). On re-reading the question, he wants to see the library code, not really the definition at all, but for others googling here simply wanting to see variable definitions (which is how I found this), I think my advice is as good as it gets (without getting a better IDE). IMHO, the other answer, "The simplest way is to look at the source on Github" is not a great answer for beginners. – www-0av-Com Jan 14 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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