Uploading code from github. .ino, .h, .cpp

Hi, im new to Arduino and I want to make this project from github "rprinz08/StickLock". I think I have wired the project correctly, but how would I go about loading this all up on my Arduino. I see different files .ino, .h, .cpp. What is the difference between these filetypes?

go to the site, click on the CODE button and click on the "download ZIP" option.

In the IDE, go to library manager and select "add ZIP library". Point to whereever you downloaded your zip file.

1 Like

All of the .ino, .cpp, and .h files go into your sketch folder. The .ino is and Arduino sketch. The .cpp files are C++ source code. The .h files are 'headers' that are included in the .ino and/or .cpp files.

The easiest way is the click on the green "Code" button and select "Download ZIP". Unpack the StickLock-master.zip file into a StickLock-master folder. Rename the folder to "StickLock" (removing the "-master" part) and drag it to your Arduino sketchbook. Open the Arduino/StickLock/StickLock.ino file and it should open in the Arduino IDE.

It compiles for me without error but has a bunch of warnings.

1 Like

Added can in above.

FYI... IMO: Arduino somewhat confuses the Arduino\libraries concept and some users (like myself) prefer to pull all lib code into the sketch folder. Example

For well-known and used libs, I generally put them in Arduino\libraries and create a new sketch subdirectory to copy a demo example. However, when I contemplate using the library in my own code to share/publish, I copy the library files (sans examples) into my working sketch folder. Often, slight modifications are required to .h and .cpp to reference to the local sketch directory.

I tend to not consider encapsulated code as read-only, often I will edit the code, add parameters, comment-out sections to suit my needs.

Primarily, excepting the IDE version, this freezes the program code and a single ZIP is all needed to email or post. The Cypress development IDE automatically does all of these steps automatically and in my years of working with PSoC I really liked the backup approach. With the large gigabyte drives, storage waste is almost insignificant.

1 Like

There are different things to make a code run on an microcontroller:

loading / writing the main code into the Arduino-IDE
adding additional libraries with the library-manager
if the library is not available in the library-manager adding a ZIP-libraries from GitHub
which is described here

best regards Stefan

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.