How to Use PyCharm with Raspberry Pi Pico W and MicroPython

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] what's up YouTube I'm back after a long break in today's video I'll be showing you how to get started with your Raspberry Pi Pico and Pie charm to start using pie charm to code your micro python projects onto your Raspberry Pi Pico and start writing python code now the reason you might want to do this over Thane is because some people prefer other Ides such as pie charm which is really popular IDE that a lot of beginners use for Python Programming so if you are using pycharm right now and you have a Raspberry Pi Pico this may be the reason why you're watching this video and you want to kick start your project by simply writing code on that IDE and sending it to the Raspberry Pi Pico so I'll be showing you how to do that quickly in this video enough being said let's jump straight into it okay so the first step is really simple if you don't have pie charm it's really easy to get started you can just go to their website jetbrains.com pycharm and click the download button and you just want to download the community version this is all you need for this video so go ahead and download it and set it up locally it is pretty straightforward and does take a couple minutes to download that and set it up step number two the next thing you're going to want to do is get the latest version of micro python for your Raspberry Pi Pico or Raspberry Pi Pico W this is simple to do and it's free to do as well you just want to go to micro python.org download and you're just going to find the device I'm just going to search for Pico here I could see there's many Pico devices and let's just go to Pico W because I'm using a Pico W like if you're using a picot it would be the same thing so let's go here and download the latest version of the nightly builds which is o511 as of the making of this video so I'm just going to go ahead and click that and download it okay now that you have it downloaded what you want to do next is you want to plug in your Raspberry Pi Pico or Pico W and before you plug it in you want to hold the boot cell button which is the small button right here it's the only button you can click on the Raspberry Pi Pico and you want to do that as you're plugging it in because this will allow you to mount the device to Port that uf2 file onto the Raspberry Pi because I'm holding the button now and I am just plugging in in with a USBC and we can see that after some time this rp1 rp2 file is going to show up on my desktop and now that that's showing up on my desktop what I'm going to do is I'm just going to go to that file I just downloaded in my down okay that's the wrong folder in my downloads folder and then I'm just going to drag it over so let's see this so this is the uf2 file over here so let's go ahead and drag it over and once we do that it should take some time a few moments here okay give it a moment and then that should disappear now once that disappears you want to unplug and plug the Pico again so now we have Micro python on the picot you don't have to hold the Boost cell button this time just unplug and plug there and then we should be good to go in terms of the firmware on the device okay so now that you have the environment the pycharm environment and you have micropython set up on your device the next thing you're going to want to do is simply go to pycharm and go to preferences and we want to download the micropython plugin which will allow us to Port the code over to our Raspberry Pi Pico social search micropython here I already have installed so just go ahead and install that and restart your IDE and you should be set up for all the plugins you need for micro python in pycharm so I'm just going to click OK here because I already have everything set up and I am good to go now that I'm good to go in terms of the plug-in what I want to do now is I want to start a project in pycharm so you simply just want to go here and go to new project we're just going to click create that's fine with the base project that they give us here and let's just do a new window let's close the previous window to we don't need that anymore and then what we're going to do is we're simply going to go to the pie charm here again we're going to go to preferences and then we want to go to languages and Frameworks and we see micropython here and we just want to check enable micropython support so this will allow us to enable micropython for the project and I'm just going to select Raspberry Pi Pico but if you have a Pico W it's the same thing you can just select picot and it's asking us for a device path so if you are using a Mac to get the device path it's just in slash Dev TTY dot star so I'm just going to go to my terminal here and I'm just going to LS that and see the path and I believe it's this one so I'm just going to go ahead and copy that and if you're not sure what you can do is you can unplug the Raspberry Pi Pico run the command again and see which one disappears and then plug it back in and run the command again and see which one appears and that should be the Raspberry Pi Pico device and this simply represents a USB modem connected to your computer and it's commonly used for serial communication with devices such as Arduino boards or other microcontrollers if you are using a Windows machine the device file a representation of a USB or other serial devices is slightly different from a Mac OS so instead of using the slash Dev slash TTY format what it's going to use is it's going to use a com Port so that might be com9 you can find more information of the com ports online for a Windows machine but going into that is beyond the scope of this video it is pretty simple to figure that out so if you have any questions let me know in the section down below and I'll try to help you with that I'm just going to go ahead and copy this and put it back in to the device path and this detect doesn't work sometimes so don't be alarmed if that doesn't work this this plugin isn't the most robust so just keep that in mind and I'm just going to click apply and I'm just going to click ok and so now that we have this IDE ready to go with the micropython plugin we can actually start sending code to the Raspberry Pi Pico W now it's really easy to do that with this plugin we just want to go ahead and right click this and run flashman.pi so run flash main.pi sends this to the Raspberry Pi Pico to run on the device so if I go ahead and run this it's going to give me the screen here so I'm just going to click around here it's fine and also we have some packages here that wants to install for the environment you can just go ahead and click that as well and let's just click run so let me run that you could see it's uploading files and it's running the files but some quirks about this IDE is it does not show you the the log of what's going on the device so if you do have some print statements it's not going to show that one example I'm going to show here is the blink LED on the Raspberry Pi Pico so if we want to Blink the LED let's actually go I have the code to Blink LED on a previous project so let's just go here and I'm just going to go to a previous project I ran so this is the main.pi file let's just open this real quick so this is a blink LED so this will blink the LED on your Raspberry Pi Pico and show that the code is indeed being ported on to the Pico because if it's not you won't see a blinking LED so I'm just going to copy that from my previous file and put it onto this main file onto this project and save it now I'm going to go ahead and run the flash main.pi so let's go ahead and run that I'll show you the the Pico on the screen so if I go ahead and run this it should start blinking every second there which is as expected so if you did everything right up to this point you should be able to send this file and see that it is interpreting the code from your pycharm IDE now what's exactly going on when you run this flash.pi well it's sending the file to your device onto the storage and it's running it on that device now if I have the the file in another file that's not main.pi unfortunately it can't run anything that's not the main.pi file so that is another drawback of using the pycharm plugin actually a pretty large drawback another big drawback of using the pycharm plugin is that you cannot manage the files directly on your device such as you can with Thani and the vs code um extension which I have a video about I'll link it right here so this part this pie charm plug-in as opposed to the other two Alternatives that is thony nvs code in my opinion is much inferior to them in terms of your development while it is nice to have the pi charm IDE capabilities with intellisense I think it's a huge drawback that I can't directly modify the files on my Raspberry Pi Pico I can only Port files over and work with them in that sense so it is a huge drawback and it is uh something that a lot of people in the comments for this plugin are complaining about so just keep that in mind however it could be useful if you are really used to pycharm and you have a really simple made up Pi file that you simply want to Port over to the Raspberry Pi Pico because I mean it's really simple to do and if you have the environment ready to go you can simply send that over now the last thing I want to show is you can actually run repl on the device so if I go here and I go to micro python you can actually start writing code here so I could say print hello and this is running directly on the device and it should show you exactly what you're doing in micropython and you can write some simple scripts here so this is pretty cool as well another advantage of using this IDE overall I do not recommend using this if you want to get serious about coding on your Raspberry Pi Pico but it is a nice way to kick start if you're doing something simple on your Pico and you are using pycharm in general so I hope you guys enjoyed this video let me know what you want to see in the comment section down below let me know if you have any questions as always guys I know it can get a little messy messing with these other Ides that aren't necessarily built with Bonnie so please let me know if you have any questions I'll be sure to do my best to answer them and stay tuned guys thanks for watching [Music]
Info
Channel: Shilleh
Views: 9,433
Rating: undefined out of 5
Keywords: raspberry pi pico w pycharm, raspberry pi pico pycharm, pycharm micropython, pycharm raspberry pi pico w, pycharm raspberry pi pico, pycharm iot, raspberry pi pico w, raspberry pi pico, pycharm, micropython, com port, code in pycharm raspberry pi
Id: aGvKvesLVKk
Channel Id: undefined
Length: 9min 29sec (569 seconds)
Published: Sat May 13 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.