Hardware Reference
In-Depth Information
The first example in this chapter will be a Hello World GitHub example that you can use as a template for
structuring typical projects. All the examples for the topic will be organized in a GitHub project repository:
http://github.com/proard . As we learn the tool, you will be able to not only get your own copy of the code for the
book, but you will be able to submit your changes back to the main project.
What Is a Project and How Is It Organized?
A project is the story of what you are working on, and then the hardware and code that make your physical project
blink, move, or communicate. You can't put physical electronics on your site, so you have to put the description of the
electronics. For our purposes, these files will count as code. and how is it defined?
The basic unit of a project is the code repository . This is where the code lives. Every project is required to have a
name and a description. A readme file is strongly encouraged as well, as it is commonly used as a quick starting point
for people to pick up key concepts and examples of your project. When you use a social-coding tool like GitHub, it
derives a starter page for the project and generates the project's own unique URL, so users of the project can find it
the project page easily. Hosting a project so that it is public and findable is a good start, but you want to encourage
even more usage and participation. When someone watches, stars, or joins a project, GitHub tracks the changes in the
repository. These changes are then emailed to them, or listed as part of their main page in GitHub.
There are two common patterns for project directory layouts. If you are creating a plain Arduino sketch, then the
folder and the sketch name are the same. So, a sketch called HelloGithub.ino would be placed in a directory called
HelloGithub . As seen in Figure 2-1 for HelloGithub.
Figure 2-1. Example HelloGithub directory layout from Arduino sketches folder
That directory would be the repository name. This way, when the project is cloned or downloaded from GitHub,
it unpacks as a valid sketch and then can be easily placed in your Arduino sketches folder as in Figure 2-1 .
The second pattern is for hosting Arduino libraries you create. In Chapter 13 we go over the details for writing
libraries. In this case there is a pattern to create a repository for the Arduino library you are writing. If you were to write
a library called “HelloLibrary” you would call your repository HelloLibrary. The repository name would automatically be
the directory name that the holds the typical files in an Arduino library. However, the name of the project and the directory
should not include a “_” because Arduino doesn't allow that in a library name. That way you do not have to change file
names when you want to download or clone the library into the Arduino sketches libraries folder, like in Figure 2-2 .
Figure 2-2. Example HelloLibrary directory layout
 
Search WWH ::




Custom Search