How to add external library in ESP IDF using Arduino as a component with VS Code

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
so today in this video tutorial uh I'll show you how we can integrate any external Library like uh like say add a fruit or some other libraries to our uh code uh where in the as we we have seen in our last video where we have worked in our Arduino as a component in ESP IDF using vs code so uh on that Arduino as a component we will add add a fruit dht11 Library here and we will see how we can work uh uh with this way so okay so let's get started so here we have our old code where we have in our hello world we have just added Arduino dot h and uh through serial dot serial dot begin we I just printed uh uh and in this uh ESP IDF basic using Arduino as a component if you haven't watched that video you can just go through go to this I button here and you will see that last video I have published on the same so here what will we do we will just work on DST one one and we will just add Adafruit Library uh in our Arduino code uh basically uh this is ESP IDF setup only if I'll show you like this is the example called hello world main.cpp and these are the things here we had showed you like shown you like how you can add this components uh and slash Arduino or Library Arduino as a whole component in this project so I'll not go in the detail of that because I had already covered that in the my last video now what I'll do I'll just go to uh to add those dst10 Library first I'll just uh open this Library thing like here we have this Ada food Library which I have installed in my Arduino IDE through word through Library manager and we got these libraries in our documents folder and then this Arduino holder and inside that these this Library libraries folder so I'll just copy these two and I'll just paste there in that section where we have our Arduino component so first we will just go to reveal in file X click on this review in file explorer so we'll just go to this by doing this we will just go to this hello world example uh and then in hello world component folder we will just click in this this is the Arduino component and inside this there is there is the libraries folder here if I'll click I need to just paste these two three two libraries I'll just copy and I'll just paste it here and here we go these two libraries are uh there now and what one more thing we need to change uh these two things we had done now we also need to change uh the cmake uh estimate list dot text of Arduino so see make list dot text if I click on that so there are these things like a library sources and other sources so here we have to uh copy include those those paths so what I'll do I'll just again go here and first I'll click on this and we will just copy this portion and we will just paste it here in in in in inside that so here we go so here we need to make it from backward slash to forward slash because this this is a kind of it takes a in a Linux Avail in LX basically we have to make forward slash so elabores then add a food you know unified sensor and then you can see that dot CTP is also included so what do we need to do we need to also include that dot CPP so what I'll do I'll just copy this and paste it okay so this thing is come done and for other libraries also we need to do that like uh we will again go to libraries and inside that there is no CPP now we have examples only so no need to do anything on examples now what we will do we will just go to DHT sensor library and here again same process libraries here alphabetically we can paste and anyway there won't be any effect on that but still things will look fine with that so DST sensor Library and then will again go to dst.cpp [Music] paste it here and one more copy and that is dhtu Dot c2p so uh this this I have included in library sources and now we need to also do in includers so in includers we will just include these uh without CPP we will just include the folders itself so again we'll go here and first this one so this way DHT sensor make it forward slash okay so this thing we have done save it okay so now what do we need to do we need to just uh write a code for that so in this example code we can see you know through this uh here DHT tester we can see this is the Kodi files say DST tester.ino so we can all are going to write the same code in uh using a wide app main format and we will just paste it on that our hello world example so paste it here and this is the same code that we have DST tester we have on that we have setup and loop part but here we have white app main setup and this way we are just working on it and now we'll just build it and now we will just flash it we will just select the com Port com Port discount code and we'll just flash it it's uploading uh 87 completed so it flashed successfully now we will just check in the uh check in our terminal border it was one one five two zero zero so we are getting output but somehow it is printing failed to read from DHT sensor let me check I'm checking it in dock light also uh we are getting filled to read from DHT sensor [Music] um uh so uh I I think I still am getting failed to read but a few values I got here uh these are the values like humidity temperature or heat index I got so I need to check with the sensor what what is happening there so maybe some issues are there with the sensor but this is the method to integrate uh the any external libraries with uh using ESP IDF and Arduino as a component I hope you understand this uh tutorial if you have any doubt regarding this just feel free to comment us below and uh if I you want to add any other Library just follow this the the path uh follow those points what I have discussed here like in how to include on includers and directories in cmake list dot text and as well as first we need to just copy those library to the libraries folder so this way you can able to run that program run that Library included code as well thanks for watching this video
Info
Channel: Embedotronics Technologies
Views: 2,452
Rating: undefined out of 5
Keywords:
Id: 7wOpKfeLd7w
Channel Id: undefined
Length: 11min 53sec (713 seconds)
Published: Sun Aug 13 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.