Get started with PlatformIO and the ESP 32

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hey there welcome back to my channel where we discuss all things Tech today we're going to be looking at platform IO platform i o is a platform that's been specifically designed for embedded software engineering and hobby electronics in order to make your life a lot easier if you're new to platform i o then this video is for you so stick around so the first thing you might ask is what exactly is platform IO in simple terms platform i o is an open source ecosystem for embedded software development it's a cross-platform IDE that supports more than a thousand boards one of the biggest advantages of using platformo is that it provides a unified interface for multiple platforms it eliminates the need to learn multiple tools and Frameworks making the development process much more streamlined okay so let's get started with installing platform IO first thing we're going to do is we're going to open Visual Studio code and then we're going to click on the extensions tab on the left in the search bar you're going to search for platform i o and we're then going to go and click install now the first bit only takes a couple of seconds to install so that's done we can close the release notes we can then go back to the Explorer close the welcome note and now we're going to click on the platform i o tab on that left hand column that's now appeared now this part will take a couple of minutes for the first time for you to load so we'll leave that to run through and install you can see the progress down at the bottom right okay so platform IO is nil installed there we go it's done we can now hit that reload Now button just to restart Visual Studio code and we can see at the bottom here that platform IO is loading and there we go we have it platform is now installed in your Visual Studio code editor okay so now we can actually create our new project first thing we might need to pull sidebar down just to see the button we've got this button create new project we're going to click that now that'll bring us into the actual Pio um home IDE page to make this a little bit bigger here and we'll wait just a second for the news to load here we go the news is loaded so you can get some some small little blogs and whatnot in there so we're going to click new project up at the top right gonna give our project a little name let's go with example Pio and I'm going to come down to the board and we're going to put esp32 is the board that we want to run so we'll type esp32 and we're actually looking for the esp32 dev module board it's the second one here framework we're going to keep is the Arduino framework for now and then we're just going to click finish well that's the project created so we can just press yes on this message say we trust the authors and then on the left hand side here we in the project Explorer we can come down to the platform dot any file click on that let's just let's go back to the any file so this is our project definition file we can see here we've got the platform selected the board set to the esp32 dev board and also the framework is set so for then come over to the file explorer we can go down to source and open the main.cpp file this is our template for our Arduino code we can see here we've got the setup and the loop functions already added okay so now we can actually put some test code onto the esp32 so we're going to start off with we're going to actually add a hash Define onto the start of this code and that's because we want to declare everywhere a value called LED and that's going to be our onboard LED on the esp32 there's an LED in that sort of pin two so it's going to be hash Define LED 2. I'm going to jump into our setup code here uh in our setup code we this code only ones the runs the once and what we're going to actually add into this code is we're going to add a pin mode so we're going to say pin mode and we want the pin mode to be in output mode that's because we want the LED to turn on we don't need to read anything so that's going to be pin mode LED output next we can actually jump down into our main code so that's the loop function down the bottom here and what we actually want to do here is we want to actually write out to the gpio to tell it to turn the LED on so to turn it on what we're going to do is we're going to do a digital write so it's going to say digital right we're going to say LED and we're actually turning it on is the equivalent of saying set it to being high so we're going to write High we're then going to do a small sleep function just to let the Arduino and Erica you can now wait we're going to delay for 500 milliseconds so half a second next we're going to add our command to say to the LED to switch off so we're going to put digital right again and that's going to be led and we're going to set that to low so what we've got now is we're going to say LED has gone High wait for 500 milliseconds LED go low now with the Arduino style code here with the loop function what we actually have is we're going to say okay we've set it to low the loop starts again and it's instantly going to be set back to high so because that's going to happen instantaneously we're not going to see the LED switch off so we're going to add an extra delay here for another 500 milliseconds and now what will happen is the LED will go high we'll wait 500 milliseconds the LED will go low we'll wait another 500 milliseconds and then we Loop through again okay so now we're actually going to build the project this is quite simple first thing we're going to do we can come back over to the platform i o tab and at the top here we can see build just click that only takes a couple of seconds there we have it we can see the Project's built okay so now we're going to have a look at installing the drivers you'll need to do this if you haven't done this before when we come into device manager we can see the device here but it's showing us an error you can click on this and try and update the drivers but it's unlikely that this is actually going to work for the sp32 so we're going to take that driver name that's there and we're going to stick into Google first one that comes up silicon labs this is one we want I'll stick a link in the description I can go to drivers go to downloads click on the Universal Windows driver there we go let's add it there is a little readme in here but it's actually quite simple all we need to do is we need to come back into the Explorer right click on the INF file and click install now that'll install it's quite quick and it's done and now when we're going to device manager we can see that we've got silicon labs and we've got com port4 now we can actually upload the code to the sp32 so we're going to come back into visual studio and we're going to click on upload in the project I O tab we can see here this is now uploading the code now I have to press the en button on the corner of the esp32 as it's booting and there we go it's now writing you can now let go of that button and that's written there we go we've got success and we can now see there we go we have flashing LED and on and off every 500 milliseconds so thanks for watching this video hopefully you got your esp32 up and running and then you can now upload code to it using platform i o
Info
Channel: John Green Dev
Views: 3,042
Rating: undefined out of 5
Keywords: Embedded Software, C++, Arduino, ESP32, ProjectIO, Get Started, Tutorial, Learn to code, Code
Id: 3ATDCi4ApY4
Channel Id: undefined
Length: 9min 16sec (556 seconds)
Published: Wed Mar 29 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.