Build Your Own Arduino Library: Step By Step Guide | Ashraf Madhoun | Skillshare

Build Your Own Arduino Library: Step By Step Guide

Ashraf Madhoun, An Engineer with +10 Year Experience

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
11 Lessons (1h 11m)
    • 1. 1 Introduction

      2:23
    • 2. 2 What is A Library

      5:47
    • 3. 3 Your First Library Creation Steps

      3:10
    • 4. 4 Create the Header File

      4:19
    • 5. 5 Coding the Header File

      14:02
    • 6. 6 Creating the Source File

      13:40
    • 7. 7 Create Keyword File and Readme File

      10:27
    • 8. 8 Create an Example and Use the Library Part1

      5:03
    • 9. 8 Create an Example and Use the Library Part2

      3:07
    • 10. 9 See Your Library In Action

      7:58
    • 11. The End

      1:08

About This Class

Build Your Own Arduino Library: Step By Step Guide

Automate and Simplify tasks using an Arduino and move to the next level of Professional Arduino Programming

Have you ever needed to alter or automate a task using an Arduino? Yes? Well, have you ever ever needed to simplify the code needed for that task into a neat collection of easy-to-use functions!

Then this course is for you! You will learn to make a library to initialize and control a small Arduino-powered circuit.

  • What's a library

  • How to Write Your Own Arduino Library

  • How To Add Library to Your Arduino Project

Take Arduino Programming to the Next Level with a Step by Step Guide on How to Build your very own Arduino Library from Scratch.

Welcome to this course.

You will learn what is the actual working principle of Libraries and start coding your own libraries, You will also learn what you can do with it and how to use it to improve your own Arduino coding style.

Libraries are files written in C or C++ (.c, .cpp) which provide your sketches with extra functionality (e.g. the ability to control an LED matrix, or read an encoder, etc.).

I'm sure that this course will take you Arduino Projects to the Next level and open your mind to new possibilities.

Goal From This Course:   

- Automate and Simplify tasks using an Arduino and move to the next level of Professional Arduino Programming

Required Materials   

  • Arduino or an Arduino clone board (freeduino), or you can make your own custom Arduino board.

  • Arduino IDE  (FREE)

  • Text Editor (FREE)

Transcripts

1. 1 Introduction: hello and will come to this new course in which I'm going to teach you how to build your own. Aren't we know lightly? This is educational engineering team. So have you ever wanted simplified or automate a task using on out? We know board If your answer was yes then have you ever wanted to simplify the code required for that task into a collection off Easy toe follow. Easy to use easy toe implement functions. If your answer is also yes then this course is for you. In this course, I'm going to teach you how to make your very own. After we know library have to write your own are due Library called How to add that library to your Arduino project on and how to use it inside any Arduino code that you are writing Creating a library will help you minimise that. Let's say, amount of court required in a single called When you have repetitive tasks, all you have tasks that require a very long code. So when you divide your code into libraries, you are making it easier for others to read your court. You are making it easier for yourselves to implement that cold on you are for sure, helping yourself on other Ah, getting a clean project five. So in this course I'm going to take you on a step by step guide. How to write your very own Are we library? Depending on your project, we are going to explain prayers. How to make outgoing rival for assemble project on how you can scale that on a much larger project on a much larger piece off court. That's it for the intro. I'm sure that you will enjoy this course. It's a very advanced lesson in Arduino. So if you are looking to go to the link step an Arduino programming, then this course is for you. See you inside habit learning from all of us here at educational engineering team. 2. 2 What is A Library: What is a library? A library is a collection off resources designed to simplify a process for task. These resources can include but are not limited to subroutines functions, classes, values or type specifications. A lot of real typically consists off the following things fares a header file. This hit a file contains the library definitions. Second, a source code. Usually I don't see PP file, which is the extension for sore scored. This contains the library's called. It also contains a cures file, usually at the text file that contains the key words used in the library. It also has a Read Me five, which is also other text file. This contains other information about the library revision number to do List the Name of the Devil, a bar that it'd date on the update date. On other information, it also has on examples. Five. It's usually adult iron or, you know, it's a typical out we know Project file. This file is your is used to show I use are have to operate the library or how to use it on their own codes by providing a quick example. All of these files should be put in a single folder, usually called the name off the library. So if you are making a library four leads, you will call it leads, library or leads, which is then Toby placed within the Arduino Libraries directory inside your computer. I will show you all of these files in this tutorial or in this course on if you are looking for a short cut, the library we are building in this course can be found in the section called Source Code inside this course. And you can read the last section for a quick example on how to use it, how to exhibit on how to start from there. But for now, let me show you a quick Okay, let me show you a library. Let's go to the out of Reno folder now. I'm inside my PC. Inside my see directory. You can goto program files here. I have the wrong files on round 5686 You can I arranged them by name. Okay, let's remove that little bit now. As you can see here we have on our side, we know folder inside that for longer. Confide examples drivers, hardware, libraries. We are looking for this folder libraries inside that you'll find libraries for different things they already made. And the Arduino ah, software that provided for free. Let's look to the servo fold up. This one is for though servo motor. As you can see here we have a keyword file. I need me fine elaborated to provide his file example file and sore scored inside the source code You can find that the text fire on other specialized files. So depending on how hard you as you can see, this is that C c B C B refiled And that takes five that we mentioned in our introduction. In this lesson on Dhere, we have two examples to show they use or how they can use this library. This is one of the two examples, So when you make a library, it will be added here inside that you will add these items on examples folder source fold are secure. File probabilities file Onda read me five The five things that we mentioned in the intro of this lecture. Now let's see, it's opening the example file. No, As you can see, this is our example file on. This is including our library. It's It's safer. The texts on this is a variable. This is how to use it. You must ensure as a variable. Then you can attach it here in the sit up, and you can use it here to write a value. Again. This is un example off a server library, which is made by are, you know and installed by default in the library's folder. That library that you are going to make will be placed here on will be added using the very same way. If you did check other libraries, you will find that they all have these five elements. Example. Source. Keyword library righties on Read me Fire. That's it for the quick intro about libraries on This is a good example for a library that is already there in your computer. You can check it out before moving, going to the next lesson. Thanks for watching this lesson. If you have any questions, please ask if you are able 3. 3 Your First Library Creation Steps: Now we are going to take a quick example on how to create a symbol laterally. This libraries purpose is toe easily control five leads connected to five digital pins on the I agree no owner or Maiga or non whatever. You have a town. Now if you want to start, I did defying things. First you need to declare declaring means that you have to declare which pins the leads are connected, toe. Usually we start with the number 1235 You have to make sure that you chose Choose that bends carefully as you write your core. Depending on this. So here are you using using Benz number 3567 and eight, which are five friends. Then we are going to turn all of these lids on. After that, I'm going to tell all of these lids off, Then flash all of these leads four times so they will go on off, on off, on off, on off. It's like four times for flashing periods, but you need to know that this is just on introduction to library creation. This is a quick example. Once you understand that example on, once you create your own library for turning on and off these five leads. You'll get a clear idea on how to use this knowledge on Implement it on your own project, depending on your code without its a symbol cord or a complex code. So, again, this is on introduction to library creation. And if you face any problem creating your own library, I can help you with that. You can just leave me a question in that you aren't able or drop me a message now, since we made everything clear once you understand how the source file and hither files are written and combined, you can modify this gold. All right, your very own called to perform lots of different tasks using a lot of other electrical components like servo motor, another led a push button or any other element that you have in your project on. You want toe automate its task. Andi, use it easily on implemented in your court. So if this steps gear, we can move on. Andi, start talking about the hitter. Five. In the next lesson, I'm going to show you how to create your own hit a file, how to write it in a step by step guide on what is the software needed to do that? Thanks for watching this quick intro about the step that we are going to go through during the next section. That's it for this lesson. If you have any questions, please ask in the Q unable. 4. 4 Create the Header File: now to start creating our hitter file, we need use a software to write our code. There is a lot of software's out there, but the one that we're going to use is called Not Bad Plus. Plus, It's a very common software during among programmers on developers. So let's head to the upside. Google on right Not bad Plus Plus it's a free software, so just click on the first link. Andi, choose the latest version. Not bad plus plus. Choose your operating system. I have 64 pit Andi. I want the installer now. As you can see, it has only 3.7 megabytes. Don't take long, about half a minute. It's used to read and write chords. Not if languages. Andi. It can identify a lot off source codes so it will help you read God's written in different languages. It also understand the Arduino syntax. That's why we are using it. Andi, once it's downloaded, we're going toe stole it on. Start using it again. You can simply search Search Google for not bad blast. Plus Okay, now it's done scanning the fight for viruses. Now let's open up the far. Okay, let's minimize this window, as you can see. Okay. Next, I agree. Next. Next in the story. That's it from Not bad. Boss Loss. Click finish. This is the user interface. This is the software called Battle Bus last. Now let's create a new file. This is our new file on this file. Let's save it. Fine. Save as no. Let's go inside. RC directory on, Right. Lead library. Inside it. Let's save the fine. As my first like stands for my first library. The techs now choose from here c++ Sourcefire. So we are saving it as my first live. The hex on that time is C plus plus source file, which includes the text that double hicks dot h p p dot h xx ah dot c b b c x x that Sisi that you know. So you know again is the Arduino extension for project files Now click Save Now are getting . As you can see, we created the Hicks file for our fare slightly after this is done. Next, assume we're going to start writing accord inside this hex file. But for now, you just need to follow these steps to install, download and install. Not that bus blast. Then save your first file as my first library. The techs Andi, choose the C plus a blast Source File file time from this group down menu c++ source type So side on dried the text here. That's it for this lesson. If you have any questions, please asking that you enable Have learning from all of us here at educational engineering team. 5. 5 Coding the Header File: now to get started creating libraries, you can go one off two ways. You can either write your own code in line by line in a very difficult manage. Or you can use at this library provided by Arduino Come bunny that provide a basic Tim Blade for creating a new library after you made you make changes to this library. In order to get it to recombine, you will have to delete the all file generated in the library directory. This library is provided for free. It's called test. And as you can see, this is all these Are the files included in that list library provided by our renal company ? Andi. As you can see, you can go inside any of these files on it. Um, easily. Andi, the other way is writing your very own library line by lying using the North bad bus loss. You can try any of these methods and of these two methods, and I'm going to explain to you how to create it using you the not bad bust los using a kombi on based method in orderto customize this library so that it can be yours. Or you can simply write your own code. Using the text editor will take away much time than usual. And it won't be as fun as everything. Something that's already there. You don't have to reinvent the wheel. So let's start by using that This lad really provided by Arduino Come bunny. Our first file is called Text the Techs. So if he did drag that file on dropped it here, we can see the cord inside. Now this is the text is a test lottery for wiring the description. Copyright 2006 John do Or at worst, you can served. You can edit this toe. Ah, match your very own all you can. Could be it on based it here, as you can see now. What's that? The next tip. We need toe modify this library so that it can work for us. How can we do this? This is very simple. Our file is named my fair slide the techs. So let's start modifying. Let's start by qualifying this comment. As you can see, these two sides means that this text is treated as a comment so it won't be executed. So let's change this with the name of our file. My first life the text Now to proceed editing the file we need to change dissed in each of these areas with my first library. So that's well, my first line slammer for slowly on here. My first on my first. Okay? No, we shared everything. Now let's talk about these. Um, we are using these two lines again. Toe identify what you are doing with this library So we can edit these to say that my fair slavery for wiring on we cannot description. Here you can light for turning and off just to show what this libraries are about. These two lines are included to ensure that this library description is only included one. So it's called, if not defined, my first Lightbody hex. Fine. Define my first level hex file. So if you found that my first library hex isn't defined, then do define it before moving on that if not defined statement checks to see if the my first Librado Tex file isn't already defined. This is to stop double declaration off any identify ours within the library. It is bailed with end if at the bottom off. The header on this set up is dawn as on include God. So if you did check, he will find that here we have in if which is the end of this if this is called on, include guard now the defined line itself. The defiant statement defines this file as the my first library hitter file so that it can be included within the source five. These two lines are now clear. You can change them, depending. Will the name few Library. Now what we need to do is simply move on after this. You need to include uh, W Constanze, the text file. You can also include on Arduino hex file the text five. These two lines are mainly used. The include off are you know that hex? Give this library access to the standard Aragona types on DCAA. Liston's such like such as? High digital, right? Digital. Read on a large. It's a necessary for sketches, but required for libraries as they are not at a you know or iron all Arduino files. So you need to include these. You can remove this one because the album of the text file includes it. Okay, again. This is for including types and cooler stance that the men are. Do we know I d provides? Now let's start with that loss. This is the name of our class. It matches the name of our library. As you can see, Andi, the class is where all the functions for the library are stored, along with all the variables require to make it over it. So it's something necessary and it must exist. As you can see, it starts here and ends here on. After that, you can add a cynical, this template you don't have toe. Memorize it. You just need to Kobe on based it and edited. But you need to understand what you are editing. This is why I'm explaining every single line now inside the class. As you can see here, we have public public and drive. It are very common names at the affair to the security of the functions and variables listed in that set, which is inside that loss. Ah, contents that our public can be accessed from a sketch for use. However, private contents can only be accessed from within the class itself. So if something is identified as public like this, my thought it can be accessed anywhere. But if it's drive it. It can't be accessed unless we are inside this close. So these are like on access. Identify ours. So the first item in the class is known at the constructor. If you have Ah, if you're familiar with programming, would know that instruct constructor is something that's very common inside a class and usually it has the last name. So it's like a methods default. Methought inside each class, you must ah, define it, even if you are not using it shares the same name as the class and is used to create on instance off the loss. It has no return time and is only used one spare in distance. So, as you can see here we have my first library. And now if you want to use pens inside Oh, if you want to specialize your code, you can edit the cord inside it. So this is just writing end. You can light end then first and then second and then failed. We are using five men's so and been forth and then this thes five events are the bends that we are going to use to connect leads on to turn them on and off so we did under for identify them or define them inside the constructor men methods Onda We defined them as Intisar so we can assign variables for them on assigned values such a zero and one for each of these pens to turn them on and off. No belong the public you can start. This is the main constructor on This is where you define methods that you are going to use . So we have a method called flash. We want to flash or turn on and off this leads. Ah, we don't want to make it void. We need to add Ah the lady because the flashing will happen Delayed Montana for flash on We need another function void on to turn on the lives on void off to tear lids off. So here we add functions that we are going to use an or code Here we add variables that we're going to use inside the main constructor. They are all public so that we can access them anywhere. Okay, now, when it comes to the bribe, it, um as you can see when dealing with private variables, it is common convention toe place and underscored before the variable name to let the user know the variable is bright. So once we I want something private, we can add it here. I don't want any private methods. I won't private valuables just like these ones. So and it's Adam underscore on and on the first valuable a game, The second failed fourth. Um, no, let's add in that school, okay? This means that these variables are progress valuables. So we did define five valuables for the five friends. That's it. This is everything that you need to go now The last line here is And if, as we mentioned earlier, it's the end rubbing off the if end if include God, which is this one. So if we did like a zoo, you can see all of this quarter silicon inside it. Come now to summarize what you need to do, need to change. My first life was with the name off your library. You need to add to include the armed wing of the text in order to be able to use up Reno methods on different variables. And that's all available in the I. D. E. You and you change the name off that the texts with any for your library. Here, you can add the variables that you need to use depending on the pains that you are targeting with your library. And here you are, the functions the public so that you can use them on a wider school. Inside the private, you identify the same variables, but you used underscore to identify it as a brive it and to make the user understand that these five variables are private valuables. So that's it. Inside the class, you must change the class name with the library name. That's it for the the text file. Next, we are going to talk about that that CBB file. Now we have created our first hitter file. In the next lesson, I'll show you how to create the source file. You just need to follow my steps. That's it for now. Thank you for watching this course on this, that if you have any questions, please ask in the Q and a bolt 6. 6 Creating the Source File: Hello and welcome to this annual Asan in which I'm going to show you how to create the source file. Creating the source scored for this library will be done in a similar way to the head are five will open a new document and not bad. Plus plus on save it as the same name for our first Fine. So we will call it my first live dot cbb on you must go on change to see blast blast source foreign Then save that file now you can Well, they invent that. Were you or you can simply go to the test folder on open up this test that cbb file Let me open up with the look that blessed us and you can't Could be the cord or that you played provided by our Guerrino. Ah, come bunny on based it here and start modifying. Get depending on your needs. We need to use the sale Two lines here. This is my first library. Don't cbb four wiring for turning leads on and off. Okay, this is the commenting area. Let's remove this Now Let's start anything you need to change test with the name off your library So my first slide my first time started. P where we have a test years. Okay, this is the last one. No, we have edited that test the techs with the name of our library. As you can see, you know, these now to start we have on include Ah, this can be chance without renal the text. The main purpose of this include line is to include car wearing a B I. The included Arduino takes gives this library access to the standard Arduino types on Afghanistan's, such as high digital riders that read and others It's necessary if you are using the intent of, you know, methods such as the just arrived. Just read and write a repeat, so you must add it to the beginning off your dot cbb file. Andi Next, you must include the X files off your library. This is important. This will include the header file so that the source file has access to the function defined definitions that you already did on your first ah library hit a fine, which we did in the previous Lysol. Now the next step will be start creating on the including the constructors. This is where the constructor. As you can see here we has a we have constructed world. No, this line can be removed because they included Arduino the text. It's used mainly to include description files for other libraries, and since other one of the techs includes everything we need. We can't move this now. We can start looking at our instruct. Constructive. This is where the constructor source code appears that double dots that are here indicates that it is a part off my first library class and should be used for all constructors and functions that are part off a class. So my first live my first line inside that you can add the variable that you already defined. And since we all defined a lot of variables, let's open up the header file on Cope with them. Here are our variables. Let's go here on based in here. No, this is where the pen mood are defined for circuit operation. So depending on the pens that you want to connect things to, who can change this? So let's go ground based. Okay, let's roll this line. We don't need it. Let's go beyond based this line. Now let's say that you won't connect them. Tobin's 23 for five on six. They are all output. Pin mood is a very common function after we know you can add cereal monitoring if you want , or you can remove it if it's not through necessary. Now we're ready to find some private variables here, so we need to assign the public variables toe the private variables. Let's roll this line on. Start doing this here. I'm copying and pasting to save time. Okay? No, inside this, as you can see what you need to do. Assembly, um, and goal he had instead of the number of friends you can chairs this with valuable name, it would be easier for anything and accessing your code. Okay with that. Now, the same thing here we had to assign. Then you'll that drive it variable to the public variable. Okay, waivers held on here. 2nd 1 here on the 1st 1 here. I know it's a lot to take in if you are new to Arduino programming. But the arguments off the constructor Arvin saved into the private variables in this area. So you need to make this step so that all of these arguments are stored inside the private variables that we already defined and our pedophile on this This tub is the assign these five friends that we're going to use for leads as output. So these two sections are very important now for the on off on flash functions, their function return type void. It's specified before the class function link. They also used the private valuable save in the constructor which are saved here. So if we want to start making our methods as you can see here public methods, we need to start everything. Then now avoid my first line. Here is the name of them food. So let's start with the on May 3rd. Inside the UN method, we are goingto add a digital, right? Okay, let's move this on this. Let's add a digital light function The own will tear alone he spends So my first been Hi on Let's go beyond based This on chairs a second. Okay, second unity Is that private valuable Inside this muscle I thought fourth on here is the fifth. This is for their own library. You can cope with this on base that year both now off means low. Now we have created the 1st 1 with hills. The failed method will be the flashing with all. So let's based this method on and changed the this with flash No, the flash. You need to tell on all of these leads so we could be the own code. Then you need to turn it off now. The flat, the flash My food takes a variable. Since we define tear, it will take a delay. Time for flash so we can cover the same variable name. And I did here on we can use the delay, we thought, and at the same variable inside it. So it will. They're on all of these lives. Then it will wait and we will turn them off here. We cannot, undoubtedly, after turning off the leads, Andi, In order for this court to repeat itself, we can at the four Lube. So for in the end here, this in J equals zero, we can make it repeat itself five times or 10 times j Blasphemous. This means that once we call the flash method, it will tell all of these leads on that it will wait until all of these leads off. That's it. This is our ah source file. Or and this is the core that you need to write. If you have any private methods, you can add them here. Since we don't have money, I wouldn't remove this. Okay, I will leave it for you. If you have private methods won't affect our code. Now let's revise what we have done. We included art. We know the text file. We edited document about two lungs. What's hard? Documents? Lines. Ah, on we are out. We know the text file to include or the libraries let me thoughts that are defining for Arduino We included the header file because we need to use the valuables on methods we defined and the hitter file. Then we start using the constructor. We passed the five variables that we already defined in the Heather find to the constructor . Then we used the pain would toe assign the five pins for five leads as output. Then we stole the pin value beside the private variable that we defined the header file here. Yeah, on once we did this. Now we can use the pin fares private, variable inside the methods. Here's the public methods area on below we have the private methods area, no inside the public, with words area we defined on on methods that takes nothing and returns nothing. All that it does is that it turns on the five leads on we defined off method that tells off the five leads. We also defined a flash methods that takes ah, really time for flashing as input on that return is nothing since it's void Andi Inside it , we turned on five leads, waited, then turned off thes five leads, then waited again on the court were a bit self depending on the number here, which is nine. This numbers This number means that this for mobile repeat itself from zero to line about 10 times. That's it for the head of fine. If you have any questions, please asking that you aren't able. I hope that you did understand what we have done here. I will provide this template file for you to edit. Thanks for watching this lesson so far. This is educational engineering team 7. 7 Create Keyword File and Readme File: hello and will come to us in your lasagne, in which I'm going to teach you how to create the cures file on the read me file. No, there is one thing that you need to know in order to create the keyword file on read me file. You need to know what are these two files inside the keyword file? You are going to place worse that it is the I d. E, which words are important on which words should be highlighted. There is two different types of keywords exists keywords for classes on keywords for functions on. Both of these should have a space between them. The key was filed for this library that we're making. Why, when it comes to the Read me file there, any file should explain what the library does. It's revision number on the date. It was last revised such that a user with no knowledge off the library I could understand what it's used for Onda when it was last edited. So let's take a quick look at our cured filed time date as a fancy here. This is the cure 54 or project. It has my first live, which is the name of our library as the fair ski world. The second key word is flash. This is the name of the class on. This is a name of a function so flashing will mean that would mean that we are turning on and off leads. So this is our second cure. So we will leave a space. The right key word to this is cured. One again, off is telling and it off, which is a function you need to leave a space you can, and more keywords as necessary. I will provide this template file for you to use on. You can simply create and save it. Now, when it comes to the read me file, let's go with this file. So this is that Read me file. It's a text five. As you can see, if we double click this file, you can see that this an exam? This is an example C++ library for our greenoe, based on one created by Nicholas for wiring zero. You can remove all of this on simply on this is affairs example to turn leads on on off. Okay, this is explaining what the library does inside the read me file now how to install it? You can leave this to install this library. Just place this entire folder as a sub folder in your Arduino live Targets library folder. Ah, which exists which fat can be found inside that program files. If you're using Windows or any other operating system inside the edwina file, you'll find libraries folders you can simply could be your library files on based them there. Now, when installed, this Labra should look like this. Now you can change these depending on the name off the lottery so that every that we are making is called lid library so we can change test related library. It's like documenting your library. Okay, Did live. You must cope with this name vested here. Here you have. If on here now you can leave these. But if you are, If you did change the name off the that cbb file on the text file, you must change them as well. So this is my the text find name again. This is like at the few monetary for your library now building. After this library is installed, you just have to start the Arduino application. You may see a few Werling messages as it's spelled to use the stable in a sketch, go to the sketch board library menu on select. Okay, then in with the rebelling which is lead or you can include it. Lead driver the techs. This will add a corresponding line to the top off your sketch, which means that it would add an include Libra line to include the library to stop using this elaborate. Read that line from your sketch. Okay, geeky information. After a successful bird of this library on your file name test that all will appear in our you know, live target libraries test. This file is the built combined library court. If you choose to quantify the court for this librarian which is Britain inside the CBB file More hex file. Then you must first unbilled this library by deleting that dirt. A test for the league lead with all file than you little about. Oh, with your code will appear after the next press wolf Verify. So because you now this read me file is modified to show what our lullaby does, How to install it, how toe Bend it on a geek Information on how you can edit this library code, you can add a date. So creation date for us would be, Ah, October first 2019. And you can also add it Date if you have. If you want to edit it in the future and you can add the edit, the first list name it fares it date. And you can add the date here so that anyone who was this library would know when it was created on when it waas first edited. And then you can add a second it it failed, did it? And so on. So now we have cured file on led file. These are two very essential files for your library. Like you were fined again. Will have the main classes on functions Name Ah, it helps. And I didn't find the man keywords in our court. Once we use the library, if we check the Arduino test library, as you can see here we have a database cured one. So has test that you old one which is the name of the class. Then do something which is the name of a function as cure too. Hey, we have instances on constants. You can add give us for instances on Constance as well. But for me, I think that it's more than enough to add classes and functions again. You have to add numbering when it comes to these. Um, adding numbering means that if you want to add ah database or that a type or class name you must now numbering using keyword. 1234 um, makes out for mystics so you can follow the albarino library. Cube number languages. Data types are a number as cured. One methods and functions have cure too. Ah, the instances are cure to as well. And if you are using an equal stance, you can call them literal one. You don't need to add any increased count numbering, Um, such as 34 or five. You just need to stick with these. So if we did, could be this que of are green on went on my template folder Inside this file, we can't simply best piece and we know for sure that thes three falls under the Methods and Functions library so we can based them here. And we know that cured one follows under data types, so we can based it here. That's it. This is how to create your cured file Using the cured filed the text document. I would provide this 10 days for you to use again. Cured. One is for data types to is for methods and functions. Cure to is also used for instances literal one is used for constants. Thanks for rushing this quick lesson about keywords. File on reading the files. If you have any questions, please ask in the Q and a board. 8. 8 Create an Example and Use the Library Part1: Now that we have created the hitter, find the source file the read me file on the key word file. We have all of the four files that we need. Our Bund ready here. Okay, let me call bodies. Here are the four fire that we needed. Now, the last time will be creating examples just like this one. So this copy this examples fallen based it here. Now, inside the examples, you have two files, as you can see here, let's or name this with dale lids. Um oh, this is the example provided inside the template. Let's check the court. As you can see, this is the code that is available inside the example. You can cook this and you go can go to the Arduino. Um, now that one of the steps are complete, the last thing to do is to create some examples. So users have a working program that explains how to use the library's capabilities. I'm going to create a simple program. Then once you have a few examples, create a folder called examples. Just like no one that we just created within the library folder on blaze. Your examples inside it. So let's create new full. Okay. No. Let me save this example. Okay, I'll go to the sea. This is the little berry inside the examples. Now you can fight the same name. And you Okay? No, let's did this description by education and engineering team. If you have outside, you can change this with any off your upside on. You must include that the techs or other file for your library. We have its name here. Okay, Now we have created this to about 2019. We have constructed find. Okay. Now, as you can see, this is defining some variables on doing some. Okay, Now, this is creating an object from our main library or our main class library. Andi, as we were do mentioned. Okay, Let me close this so that you can see what I'm doing. We already have my first life. That take five. That takes five into girls. So we are going to put then the numbers that we want for the pens. So too. So you for five on six. So my test will have my test will have access toe these four. All of these five pens, the next step will be okay. using our my test. Ah, object inside the room. So my test Don't do something. Ah, do something. Isn't Taliban that were defined? That I be that we defined is on off or flash So you can't simply light on my test it on Aunt will tell on the leads. Then it will wait. You can. Then he was my test that off. I will tell of the leads. Then it will wait. That's it. This is a good example for using the library that we have created. 9. 8 Create an Example and Use the Library Part2: In order to start using this library, you have to first go to the library folder. You can keep the same name for the first library to see baby on Fierce level the fixer. Or you can customize it with a new name. Big. Same. My first lever lid. Um, name the hex. Fine. My first library. Now you can name the rain fold up as well. My first library lived. Now this clear as it fine for our slavery. That guy them. Okay, now here we have as it five named my first library blend. Let's go toe ugliness. Now, this is the example that we have been working on. What you need to do is go. The tools sketch include Lemole added zip library No. Go to your C directory to the library on and include my first life blades. You know, project Now you must make sure that the text find included matches the name that exists inside your library. So my first live live same thing to you, Kobe. This tasted here and here. Create on object from the class named. My first library lived here. We are signed a five friends that are going to use on Dhere used the object to tell on which is the method to tell London. Let's on to tend these days off. You can also like my test. Don't thrash chop, which is the field with that we have created. Now click on that verify battle. It will combine your court. Now there is a narrow it say's the the missile flash needs on input, which is the time delay. It's at 500 minutes. I come then click on Verify again on you should be good to go. Okay, done. Combining. That's it. This is how easily you can add your library. Teoh Albarino Project Inside the abdominal Ivy. If you have any question regarding adding your library, you can ask it in the Chianti. Able. Thanks for watching this lesson so far have living from all of us here at educational engineering. King 10. 9 See Your Library In Action: no one would come to this annual assume in what you are going to start our library. For us to this, this library. We need toe run, a simulation software I'm going to use brought us if I want. Explain each and every step brought us because you must have at least a basic knowledge using it. There's, of course, that we already made about brought us. It's called Circuit Is On and Simulation all. You can check our picnic control, of course, or any of our Albarino circuit design courses. But I would take you on a step by Step on what's important for us to to start out well aboard using progress. The first will be running, brought a software so go to start menu go for the app Center Electron exporter, then the PDS, which is brought US development software. This is the user interface. You can easily click on any product that you are the maids off. You can start a new product now fired. New project. Here is the name of that project, like renal this thing on. Save it anywhere. I will save it inside our library folder, which is here. Pick next next next. Next Still finished. Here is There's a interface from here. You can drive on, drop the components. We need a live well here and choose an active lived animated. We need resistors on. We need our renal now. As you can see here we have off Sabrina balls on the one that we are using here is called Al Green. Oh, ah, Might for off channel. So let's try the albarino. No, you can't extort libraries for albarino. Onal, Omega. About the only works, the same now as you can see here we have the pins. You can simply connect at 220 ohm resistor. And of it, as you can see here that it must be connected to ground. Now, if you want to tell Mom that you can simply collect it of our here, But I'll connected to the one. Now select this area on click lock coffee. Day two three for on fire. Okay, on six. Now it's from this one. Now let's connect These simply drag on draw drug on, drop back and broke that. I gotta go. I go now. If you lovely click this Ahad we know nano uh, schematic or icon you will find an area where you cannot The hex. Fine for the other. Well, so if we went back here, Andi, we didn't change this toe out. Greenoe No. Then pretty combined The cold. Done. Combining. Now go to the tools. Grace Kitsch shows Kitsch Folder This is our sketch folder on Bond. You can export combined. Finally, Toby the Hex Fire. Go to the sketch, then exposed. Combined. Finally, as you can see, this is our good hex file. We just go with this directory. I go back. The other software click here based the directory. How you can simply find the next flight here. Click. OK, let's test it out. As you can see, home till off. Now it will start flashing on and off just like what we programmed in our library. This is have this doubt your library using protest professional software. There's a lesson on how to download on industrial process professional software on this is the library working. I'm functioning correctly so that we can simply see what we have done in our court. Action Music on actual ugly aboard. As you can see, the elaborate that we made tell these lives on then waited half a second and tell them off , then waited half other half a second. Then it's started flashing for 500 milliseconds. All of these lives you can move any of these lines on, keep them on forever. Let's to stop these now. If I remove these two lines, then it's well, they're long and will stay on. But what you need to do is export combined library again. So with the sketch explored combined, finally, then along. This is where again, As you can see, they are always own just like our court. Now this court has only three lines on can control five leads. This is how also I'm making your own library is. But again, making libraries isn't all about. Just creating a TEM leads on and off. You can create a library that combines these evil toe save more for mathematics. Seven. Signal visibly on the other stuff where you can light. I've been called. That's clean and clear on only has lines to identify. Been number Just like this line. Using libraries will for sure make your court look more professional on. We'll take it to the next step and program with obtainable I will attach some advanced Abdul libraries. You can check them out on bail from them, but that's it for this lesson. If you have any questions, please ask in the Q and able. Thanks watching so far. Please don't forget to review the scores. This is awful, awful educational engineering Ting. 11. The End: this is the end of this corpse. Now, if you have any question, you can ask it in that you aren't able all you can. Send me a message. You can also teach me out. Uh, these e mail Move our lumber on using Skype by sending me a message on this account. PNG s I'm 89. You can search for it. Sky fall. You can reach me Via what sub? Or call me via this number. You can send me an email. Andi, I can help you with anything that you couldn't hand in this course. If you have any special request, you can also contact me. Or you can send me your questions. I'll be more than happy to help you. So your issue tax will taking the score so far. If you didn't yet review the course, please do. This will help us improve on breach more audience. This is Ashraful Education Engineering team