tonydeakin:
I'm unsure what command to run or button to press in the IDE to install the libraries
In this particular case, the library is in the Arduino IDE's Library Manager, which makes it extremely easy to install or update:
- (In the Arduino IDE) Sketch > Include library > Manage Libraries
- Wait for the download to finish.
- In the "Filter your search" field, type "MFRC522".
- Click on "MFRC522 by GithubCommunity".
- Click "Install".
- Wait for installation to finish.
- Click "Close".
tonydeakin:
I'm unsure what language this project is written in
It's C++. You can tell that by the .cpp extensions on the library source files:
However, the language of an Arduino library is not generally of concern to you. They can all be installed the same way. You would only ever find Arduino libraries written in C++, C, and assembly. The latter are not common and even those libraries that use C or assembly will usually have some C++ code as well.
tonydeakin:
how the IDE usually loads a project
The first thing you need to understand is that there are two types of code you will find online to use with Arduino. Each is installed and used differently:
Sketches: These are the programs you write in the Arduino IDE. You can load a sketch into the Arduino IDE by downloading it and then using the Arduino IDE's File > Open to open it. Note that the Arduino IDE requires the sketch to be in a folder that matches the filename of the .ino sketch file. If this is not the case when you attempt to open a .ino file, the Arduino IDE will prompt you whether you want it to move the file to an appropriately named folder. Generally, that works fine, except when the sketch contains multiple source files, in which case only the specific file you're opening gets moved and the sketch doesn't work. In this case, you would want to manually rename the sketch folder before opening it. You can also load a sketch into the Arduino IDE by copying the text of the sketch and then pasting it into a new sketch in the Arduino IDE. Note that the Arduino IDE comes with some example sketches under the File > Examples menu. After you install a library, it will often add its own examples to that menu.
Libraries: GitHub - miguelbalboa/rfid: Arduino RFID Library for MFRC522 is an Arduino library. Libraries are collections of generally useful code that is packaged in a way that makes it easy to use in your own sketches. There are a few different ways to install a library, which are described here:
https://www.arduino.cc/en/guide/libraries
The best one is Library Manager, which I already described above. But not all libraries are available in Library Manager so you may need to use one of the other installation techniques (more details on this below).
tonydeakin:
Does anyone have a link to a tutorial which would show me the steps to get a project of this type from github to install the libraries
First of all, this is not "libraries", it's a single library. I already explained how you can install this particular library, but you will find other libraries on GitHub that are not in Library Manager so it may be helpful to explain how it can be installed without Library Manager:
First of all, you need to download the library. The library development is being done on GitHub. Generally, it's best to use a "release" version of the library when possible, since that version will be less likely to have bugs:
Now, some repositories won't have any releases yet, or maybe you want to use the current library source code in order to do beta testing or benefit from development work that happened since the last release. In that case, there is a different process to download the library:
Now you have downloaded the library in a .zip file. The next step is to install the .zip file using the Arduino IDE:
- (In the Arduino IDE) Sketch > Include Library > Add .ZIP Library...
- Select the downloaded file.
- Click "Open".
In some cases, after doing that, you might get an error:
Specified folder/zip file does not contain a valid library.
If you're certain that you did download a library (and not a sketch or something else), the problem is usually that the library author did not create the correct folder structure for compatibility with Add .ZIP Library. That installation method requires that the library is in the root folder of the .zip file, not in a subfolder. In this case, there will be an extra step to the installation:
- Unzip the downloaded file.
- (In the Arduino IDE) Sketch > Include Library > Add .ZIP Library...
- Select the subfolder of the unzipped folder that contains the library.
- Click "Open".
It's not obvious from the menu name, but Add Zip Library can be used to install libraries from a folder as well as from a .zip file.
tonydeakin:
and then compile and run this code?
A library is not a complete program. It's just some building blocks you can use in a sketch. So you can't directly compile a library. However, most libraries do come with example sketches that demonstrate the usage of the library. After installing the library, you will find these examples under File > Examples > {library name}.