How to print a complete Sketch.

My current one is the advanced alarm clock.

It includes a couple of libraries.

To try and help my understanding of how it all works, I would like to print the whole thing out.
Libaries included - so I can see the WHOLE picture.

As windows is petty about what programs open with what, and all that, I am guessing open with/ and then use WORD. Notepad just prints it all on one line.

But how do I know what libraries to also include - and that isn’t as silly as it sounds.
Although the code says include <foo.library>, is it I need to print foo.h, foo.cc, foo.something else, or what?
Or is it ANY of them would suffice?

I don’t mind printing them - work’s printer - but simply printing for the sake of printing is wasteful.

Thanks.

The reason Windows sees it as a single line is because Windows needs both carriage return and line feed characters for a new line, while Linux (and the Arduino IDE) use only a single character for new lines. There are plenty of "text converters" that will take a text file and add the extra character to make it look correct on a windows machine. Just google linux to windows text converter.

As far as which files you need, the typical convention that gets taught in institutions is to store the function and class prototypes in a .h file and the implementations in the .c file, however, that is not an absolute requirement. Sometimes there is no .c file and everything is implemented in the .h file, you'll just have to go through the header files and see if the code is in there, otherwise, it should be in a .c file.

Try something like TextPad (http://www.textpad.com/). It will interpret unix-type text files properly.

lost_and_confused: I would like to print the whole thing out. Libaries included - so I can see the WHOLE picture.

I don't mind printing them - work's printer - but simply printing for the sake of printing is wasteful.

You have got to make a compromise, because the whole picture obviously includes everything, but most likely you don't actually want to see the whole picture.

I assume you will print out all of the code you've written. As far as libraries are concerned, it would be worth printing the header files that your sketch includes directly. They may in turn inc lude other header files; it might be worth looking into them to see whether they're defining things that affect the interface of the library you're using. If they are, they're relevent to you.

The library implementation will usually be in one or more .cpp files. That might be interesting to you as a demonstration of good coding techniques, or to indulge your curiosity about how it works, but usually you would not need to look at the implementation of other people's libraries in order to use them. (But sometimes, if the interface os poorly designed and poorly documented, you may end up wanting to see the code to understand how the interface is supposed to be used.)