‫All right, I hope you're enjoying the cause so far in this video.
‫I want to introduce you to the black box libraries.
‫What are they how can we use them if we don't know the documentation?
‫Exactly how can we change the library, for example?
‫How can we add functionality?
‫Those are all topics that you can tackle if you have a basic understanding of what libraries actually
‫are.
‫And honestly, if you have never had any experience with object oriented programming, this video right
‫now is going to be kind of a tough one because, see, the libraries are written in C++ and they are
‫all object oriented.
‫So if you don't really know what object orientation is, you've never got in to touch with any object
‫oriented programming language like Java, then I don't think you fully understand everything, but you
‫can still watch it and I hope you'll get something out of it at least.
‫But if you've had experience with object oriented programming languages, then this video is a very,
‫very brief introduction, introduction into how C++ and in general in C and C++ the orientation is working.
‫So let's just get started.
‫And C++, we have to a feel for every class in C++.
‫We have two files.
‫We have to dot h file and dot cpp file and file.
‫There's no implementation of the functions.
‫There are definitions of the functions.
‫They are definitions of the constructors.
‫So let me show you, for example, down here, we can see that here are the definition of the constructor,
‫but the implementation, the actual implementation for this constructor is in deep start CPP file and
‫this goes for the other functions as well as some for for the distractor, for the methods like EZchip
‫connected begin.
‫They are all defined in the dot h file together with the attributes and other stuff like typedef Venom's.
‫But the implementation is in the CPFL, as you can see here.
‫Here's the implementation for the constructor and the first thing we might stumble upon is the class
‫definition.
‫We have a class of twenty 24 and the object oriented typical stuff is in like attributes which are private
‫for each class are here in the private part of the class and we have the protected part and the public
‫part.
‫So the public part is reachable from outside.
‫From our oenophile, we can call everything that is defined in the public part from our initial file
‫and the private stuff and the protected stuff.
‫We cannot call.
‫So we can't directly get, for example, this attribute because it's in the private sector.
‫And obviously, as you probably already know, if you are familiar with object oriented programming
‫languages.
‫So we basically just have a class which provides us with some functionality.
‫And in a private class part, we have to find different pins for the chip.
‫And able of the attribute is here is the chip and pin DSP Chip Select PIN.
‫We have a attribute for the spy plus speed and so on and down here.
‫We, for example, have a address with the address with to use three, four or five bytes.
‫And as we've seen, the normal address width is five bytes wide.
‫This is the case you'll see in the second.
‫So down here in the protected, we have some other functions that are not of our interest.
‫And down here we have the constructor.
‫This is where stuff gets interesting because we have a very good we have very good documentation over
‫here.
‫Creates a new instance of this.
‫Driver, before using you create an instance and send in the unique pins that this chip is connected
‫to.
‫So we gave it to Chip and Able PIN and Chip Select PIN as we did.
‫Chip and Abel was eight, I guess, and Chip Select was PIN.
‫Now we gave it to this constructor.
‫And what is the constructor actually doing with those is defined in this CPFL as you can see here,
‫we have the chip and able pin which is set the the attribute is set to so, so in the file faulty attribute,
‫chip and pin is set to the given parameter as well as the CHIP Select, not PIN and other private attributes
‫such as the address which are set to initial states.
‫So by calling the constructor the the actual class internally or the library internally sets the address
‫with two five and probably down here in the public methods that start from here, there is somewhere
‫a method or function that we can call to set the address with as as we like.
‫So if we look down here, we have a function that says begin, begin, operation of the chip, call
‫this and set up before calling any other methods.
‫So actually, the authors of the library provided us with enough information to code or to use their
‫library without knowing anything on how the code actually works.
‫So just by looking through the library, we could figure out how to actually call them to we could figure
‫out what to call in which sequence.
‫So we first have to call begin.
‫Then we have a function.
‫We can see if the chip is connected to the bus.
‫So if we need it, we can call it.
‫Then we have start listening function, start listening on the pipes open for reading.
‫You sure to call open reading part first and so on.
‫So as you can see, we don't really care about how this stuff is actually implemented.
‫We just want to use it so that CPF is not really of our interest at all.
‫We are focused on the dot h file where every function is described and in it's also stated in which
‫order you should call everything to make it work.
‫And actually it's also stated what everything does.
‫So I think if you go ahead and just look through here, you'll get a good understanding of what functionality
‫the library actually provides for us and how we can use it.
‫And it's a lot of code and a lot of documentation.
‫As you can see, if we scroll down, this library has like 2000 lines of code and documentation, which
‫is good because it means they documented everything very well and user friendly.
‫And I know this is just a brief introduction.
‫I just wanted to give you a quick insight into what the library actually does, how what is this library
‫thing even doing?
‫And, you know, now it's just it's just a class definition which provides us with functionality.
‫That said, nothing to special.
‫You don't have to be an expert programmer to write your own library.
‫You could go ahead and try to write your a library for the item you implementation, where you have,
‫for example, a public constructor and a function that says that goes something like get angles and
‫it just spits out the actual angles which are calculated by getting the exhilaration and child data
‫and converting it and and so on and so on and maybe even have some automatical offset generation.
‫But the user just wants to get the angles.
‫And this is where libraries are so useful we don't have to really we don't really care about how it's
‫done.
‫We just want the result.
‫This makes programming with Arduino very efficient because we don't have.
‫You explicitly program how everything works and can't just take the working and debulked code from others.
‫So in this case, I'm always kind of going over such a big topic very fast.
‫I mean, libraries and classes and object oriented programming is and could be.
‫And I'm pretty sure there are only courses which go in just about object oriented programming in C++.
‫But I think it's important that you just get a feeling for what a library actually is.
‫And if you're if this is a topic that that you're especially interested in, you can go ahead and try
‫to learn more about it, because it's an interesting topic.
‫But if you don't really care about it, then this was just a brief introduction to.
‫So maybe you learn something, maybe you didn't.
‫But in any case, we're going to continue by just utilizing the public methods that are provided to
‫us in those libraries and don't really care about the implementation too much, which makes programming
‫efficient.
‫So stay tuned for the next videos.
‫We're going to cover how to read a joystick and then we're going to transmit the joystick data over
‫to the receiver.
‫And after we've done this, we're going to continue to build to build the remotely controlled car was
‫an experience.
‫So stay tuned.
‫Going to be fun.
‫See you.