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

asked Sep 26, 2016 at 15:41

2 Answers 2

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.

answered Sep 26, 2016 at 15:53
3
  • 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 Commented Sep 26, 2016 at 23:25
  • 1) use git. 2) use grep. Both from the command line. And no, they are listed alphabetically (case sensitive). Commented Sep 27, 2016 at 9:46
  • Or alternative to 1), click the root of the repo, then download the zip. Commented Sep 27, 2016 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).

answered Nov 14, 2018 at 14:03
2
  • what? In Arduino IDE? Commented Nov 16, 2018 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. Commented Jan 14, 2019 at 17:52

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.