Easy Migration from Arduino IDE to Platform IO Part 1 of 2

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Not sure what platform IO is but What about easy migration from Arduino IDE to using cmake with the idf as a cmake lib? My team spent over a month migrating, it was a nightmare at first.

Does platform IO give the same flexibility cmake as a lib does?

👍︎︎ 4 👤︎︎ u/YoureHereForOthers 📅︎︎ Jul 18 2020 🗫︎ replies

Never had heard of platform IO before. What are the pros/cons?

👍︎︎ 1 👤︎︎ u/jemsipx 📅︎︎ Jul 18 2020 🗫︎ replies

I just migrated my current esp arduino project, while following along with the video. I only had a few simple code fixes and it compiled and uploaded just fine. Simple. I've barely used VS Code before this. It and platformIO. They seem solid. I will continue my project with this IDE and see how it goes. Thanks for the video, u/jrubin6502

👍︎︎ 1 👤︎︎ u/visualkev 📅︎︎ Jul 18 2020 🗫︎ replies

The one glitch that you will run into with PlatformIO vs Arduino

all subroutines must be defined before you use them - Usually there is a quick fix - move the Main() and Setup() to the end of the code ... Or put a definition before them in the header of the code...

Otherwise if you have used eclipse or other IDEs - you will love it. It lets you make MUCH larger projects and keep them corralled into the source editor ...

👍︎︎ 1 👤︎︎ u/K3SYD 📅︎︎ Jul 19 2020 🗫︎ replies

Is it entirely free, or do you have to pay to use some features of Platform IO?

👍︎︎ 1 👤︎︎ u/mykesx 📅︎︎ Jul 19 2020 🗫︎ replies
Captions
hey everyone in our last project we use the Arduino IDE and a TT go t display ESP 32 to create a simple project using a dht22 sensor completing a particular task decided how to be physically constructed assembled and in most support libraries who printed rudimentary user interface for the program evaluated I'll work at regular intervals added more features and refined our code to meet our goal and eventually met all the parameters that determine the completion of this project but it wasn't quite that easy because if you remember from video 1 we had all the prerequisites that had to be met before we were even able to start this project this including edit the additional board manager URL searching and installing ESP 32 universally selecting the particular board for the arduino ide installing further support libraries required by our hardware and then configuring these libraries globally with regard to arduino ide and all that work got us a rainbow on the screen still had to install add-ons to allow data to be pushed device and supported v FS then while arduino ide is pretty awesome once you do get it up and running you do find that for the more advanced user it's missing a lot of medium to advanced features by designed to stay simple for beginners it doesn't really have many features at all i want to talk about another ide that i use called a platform io this solves for a lot of the problems that i deal with with ESP 32 development there's a degree of misinformation out there as to the complexity of this ide and who it's appropriate for i'd like to dispel some of this information and for the constraints of this example I'm going to drop in this program I'm gonna cut and paste our program from the last example right in that's what we're gonna do we're gonna get the entire thing up and running from installation to operational and cut and paste the program right in and then we're going to show the benefits of platform IO and some of the things that it can do and its advantages so let's get started since both ideas are gonna require a USB serial driver installation for mac and windows I'm including that small section from the first video in the series so you won't have to go to a separate video for that information mac and windows we require the CP to 10x driver listed at this URL here so in the comments below choose the one you need and download it Linux doesn't need any of this nonsense so if you have Linux don't worry about it what you've installed the driver on the Mac and rebooted if necessary you could open up a terminal window plug in the device type sudo - s and then D mesg check the output to see if the driver latched onto a device in the dev directory on the Mac you'll see tty dot s lab underscore USB to UART this will confirm that you're ready to use the device we select that device for the port on the Mac and in doing so we should be ready to go then we see the CU s lab USB to UART M Linux plugging it in and type in diem ESG will even tell you the name of the device that is bound to in this case TTY USB 0 and we can see looking at the port can figure on the Linux box one of the available options on here is in fact the V TTY USB 0 as we know is bound to the interface that is our ESP 32 as it says here platform IO installs on top of Microsoft Visual Studio code so we would install a Visual Studio first so we'll direct our web browser to code Visual Studio comm link also provided below it should choose the appropriate download for your computer though you can choose which download you want and break it down for Mac Windows or Linux if you're gonna use a rpm for Red Hat of Deb boon to what have you download the correct one choose the stable one especially if you new to this save that file or execute an install file whatever's appropriate for your operating system conduct the installation of this program however you install this program on your operating system this is just how I do it for the Mac installations completed and now we're gonna open it up first thing we're gonna do is the program opens we're gonna click on extensions here this icon with the four squares and we're gonna type in platform io one word and we're gonna see platform IO IDE in the results we can see this one come up and we're gonna click the green install button and what a way for this to install it's gonna take a little bit to accomplished and the platform IO installation is complete just make sure the show at startup checkbox is clicked actually exit out let mine load again make sure everything's working just fine we can now confirm connectivity to the ESP 32 by clicking on devices as shown here and we could see that device see us lab USB to UART this entry right here should look like mine you click refresh if you want to but that confirms everything's looking good we're just gonna kick this off by pressing new project choose an appropriate name for our project as all the boards are loading notice we didn't have to install anything specific for ESP 32 it's just all taken care of automatically for us currently as we select boards we see 810 available and we could scroll down forever and ever to try and find a board but in actuality just by typing in the first couple letters I could see TT go Laure 3200 led V 1 and that's the version 1 board the one that I'm using so I just select that right now that's all I have to do for the board that's done configured finished for framework we're gonna use Arduino which is exactly like the Arduino IDE the way that we program that's gonna allow us to drop in our program ESP IDF is an entirely different way it would not be compatible with our program and we hit finish while the project is being constructed it provides you some information and the wizard about important sub directories and configuration files we're going to get into these individual areas in just a bit scrolling down from the main landing just off to the right as I go to the bottom we could see in recent projects that new project that was just created we could also see it open in the Explorer just off onto the left hand side as well a quick glance under source reveals main.cpp and as we open that up we see it looks exactly like a file we would expect to see in arduino ide except in this we will always see in include arduino dot h this is required and is one of the exceptions that we will have in platform io so now we're gonna look at one most important files in the project platform io dot ini and we could see that some of the information already been filled out when we initially created this project saying what type of ESP 32 device and what type of framework that device would be and you could get really complicated with this file very quickly have multiple devices multiple frameworks we're assuming one device and I'm gonna add monitor onto this we're basically saying for the serial output what's the speed on Arduino we actually have to go and do a drop down list from the serial monitor to set the speed but we're saying for this project for this device this is the speed we're gonna set and while this project didn't post to the serial we're gonna create a few examples like I said I'm gonna copy the entirety of the program that I made an Arduino IDE we are gonna paste it right into main dot CPP the only thing that we're gonna preserve obviously is include the Arduino dot H so I'm just gonna paste this in and then I'm gonna go and relocate that include into the location with the other includes given time we could see that there are three hours we would expect that there would be a couple of errors they should be obvious and we'll discuss them now and it stands to reason if we build this project from the ground up rather than cutting and pasting it that we would have already made these libraries available for our hardware such as DHT and we could see that the library was not detected and that's one of the two errors we're finding here I could click this icon right here on the bottom left for a summary of easier viewing of all errors and warnings and it's telling us what we already know we have to install libraries the third error listed is just a catch-all include error in Arduino if you wanted to install a library you globally install the library for everything for all hardware one version and that was it this is pretty much how it was done made things easy but not very flexible we're gonna see how to do it now in platform il and we're gonna click on the libraries icon on the main landing in the search bar I'm gonna type d HT and yes for specific hardware obviously it's gonna take a little bit of research to figure out what library is going to go to what piece of hardware for our purposes DHT is what I'm going to search for it to pull up the library for the DHT library and we could see the DHT sense a library for Adafruit comes up first happens to be the same library we used in our dueño IDE and so I click on this to drill down for more information we see the same examples that we saw provided on the webpage for Arduino but more importantly let's take a look at the installation section long story short about what they're talking about an installation is we're going to use the platform IO dot ini configuration file to say build in these libraries into each individual project instead of globally installing this library into platform IO and making that one library available to all projects that way within each individual project you could say I want to use this version of the library or the latest version of library and what have you and you could pull that version or the latest version or a specific version that you specify into a particular project so I demonstrate this new field in platform IO dot I and I live underscore depth equals you need two spaces before you begin a list in this configuration file so space base and I write DHT sensor library exactly like the installation tab called for but as we switch back to main.cpp we'll see that the error for DHT still persists we'll want to use this button for compile but not push to device to build that library into our project looking at the output of the build we could see that the DHT library was pulled into this build also we could see the dependency graph also shows DHT being pulled in as well of course they're still gonna be an error in the cap aisle that should come as no surprise and we could see TFT library is gonna be an issue but we're gonna click on the error button on the bottom left just to have a better look and see again we could see the TFT library not being found as the error and the oil inclusive include error is shown but if we look back on main.cpp we see that we've cleared the issue with DHT dot H so we're doing good we'll address the last librarian we should be good to go we're now going to add the library TFT underscore ESPI for odd display and we search for that it comes up as the first one let's select that now and again we're going to take a look at the installation tab to see how the install is recommended we're going to find that it's the same as before to add it to the live depth option so we can locally build it in as we compile the program we'll take a look at what the name of that is and we can see under live depth it's going to be TFT underscore ESPI let's do that now now we'll recompile and our code is compiled error free with all dependencies and no modification we'll remember back in Arduino IDE we globally configured what board we were using for TFT ESPI this was board 25 the TT go t display that i've highlighted here but if I actually open up config 25 we see that there's a series of parameters that make up that configuration for the TT go those parameters are going to need to be put in our configuration file for platform io for our project so it knows what type of display we have and how to reference all of that information these parameters will go into an area called build flags in platform ayothaya and i create that now and then we'll copy it right over I had the first parameter user setup loaded and then all of the other parameters below with a dash D followed by the parameter and the value is shown I'm going to add a link to these configurations in the comments below so we hit the build button again and we see that because we changed the config file everything is completely refactored it's a complete rebuild and it was a success so we're gonna hit the upload button to the right of it which is a build and pushed to the device activity that was successful let's have a look at the device as one would expect there's zero change in the functionality of the device it operates just as it did when it was compiled and pushed on arduino ide i'll be continuing this video with a follow-on video that's gonna discuss an issue i found with the interrupt and GPIO 0 which this button that I'm currently showing is connected to all so we're gonna get more in-depth look at the ite of platform IO itself talk about some features adding in your own personal libraries as well as adding data as v FS so do me a favor hit that like button down below helps me out a lot when you do hit that subscribe button for more videos again I'll post that link in the top right when new video comes out I hope you enjoyed this video thanks for watching thanks for watching would you like to reply
Info
Channel: Retro Tech & Electronics
Views: 13,452
Rating: 4.9672804 out of 5
Keywords: arduino ide to platformio, migrating from arduino ide, arduino ide, platforio, compatible, migration, howto, example, starting with platfomio, moving to platformio, from arduino, esp32, ttgo, t-display, cut and paste, visual studio code, visual studio, arduino.h, platformio.ini
Id: C_Th3e-HnDY
Channel Id: undefined
Length: 14min 28sec (868 seconds)
Published: Sat Jul 18 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.