Getting started with C/C++ & MicroPython on Raspberry Pi Pico on Windows

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
considering how many of us are using windows on their pc to program i'm just scratching my head why this is so difficult oh by the way thanks to dmitry for giving me a hand with this because otherwise i'd be so lost hey guys i got myself three raspberry pi pico y3 well that was a maximum i could purchase they are inexpensive and because i knew are going to live stream me playing with this i wanted to make sure i'm not going to blow the first one up and then i have nothing to show during the live stream so yeah i got three of them but that wasn't actually the problem during the live stream i've discovered that the documentation is like 70 pages long if you go for getting started guide and 265 pages long if you want to have a complete breakdown of sdk for raspberry pi pico that's probably more that you would like to spend to read just setting up a blink sketch right so i'm going to help you out guys and i'll show you how to program on windows using raspberry pi pico now in here you're going to see two time stamps they're going to show you a raspberry pi pico sdk for micro python and for c and c plus plus now if you didn't make up your mind about which programming language you want to use go for micro python because it's so much easier to set up and you'll be able to jump straight into programming and enjoy your projects but if you absolutely fixed on c at c plus plus on windows well keep on watching because we're gonna go through this as well as men have mentioned micro python is gonna be easy so navigate to tony which is a python ide for beginners and it's super simple download version for windows it's linked to the top of the page don't use command prompt to install like i did on my live stream and then open up the it's worth noting that the python 3.7 it's already included in installation so you don't have to download the python separately but if you want to have a latest version then you might just download the python as well if you want to the first thing to do is just go to tools options and interpreter and select raspberry pi pico it should be there you can leave the port out to be selected automatically it's going to be all right then press the button on the raspberry pi pico and connect it to your computer you'll enter it as a usb drive and then you can install the micro python firmware on it so i'll just proceed with installation and only going to take a couple of moments now that you have a firmware on raspberry pi we can confirm that it's working by running a very simple program i'm making a very simple print statement which i'm going to execute on raspberry pi a pico before you can run the code you have to save it on the raspberry pi itself so it will execute on the raspberry pi and provide you output in the shell you can name it whatever you want as long as it ends with py hit run and you'll see hello not enough tag in your shell version running from raspberry pi but if you disconnect the raspberry pi and try to run it nothing will happen because raspberry pi won't know which program to run to select that default program that's going to be executed when you connect the raspberry pi to power source you have to name it as main dot py as you can see this is a driver for led for ws ws2812b and once i save both files main py and ws2812b on raspberry pi it will execute them as soon as the raspberry pi is connected to a power source that's pretty everything that you have to know to get started with micro python on raspberry pi pico you can find links to all the download on my page and that's going to be linked in the description of this video there's a couple of things to download so i'm not going to bore you with downloading it i already have it in a folder so let's start installing and i'll just point out the important bits the files aren't too big but one of them it's gonna have a download which is slightly bigger so bear that in mind as this will take a moment depending on your connection when installing python make sure you add the 3.9 to path and then click customize click next and then install python for all users that's all you have to do and we'll move the installation directory to program files when the python installation is done we can move to install compiler for vs code there is one thing to bear in mind at the end of it you'll have to again add the path but also the installation will hang for a moment and it will open command window the app might appear unresponsive but if you give a couple of moments it will show a readme file and that's going to be indication that actually the installation went successfully and then you can exit the shell as well next up is cmake there is no big changes here all you have to do is go through next and accept terms and select cmake to be installed and added a path for all users visual studio build tools are next and that's gonna take a moment on you but fortunately you don't have to install everything all you have to do is just install build tools for c and c plus plus also make sure that c plus plus c make tools are selected last on the list we have via studio code and again just make sure that the path had been added as well as an option and then followed through with installation next up navigate to system environment fireballs and select environment variables as we're going to make sure everything is there and add a couple of them first to add so click new in user variables is pico sdk path and value should be a directory where you're going to download your pico sdk to download your pico sdk navigate to github for raspberry select picosdk and download the zip you have to download this and unzip it into location of your choice but that location it should be the location that you going to use in a path if you don't want blindly type the location use browse directory to select a folder that's going to be pico sdk now in user variables open path and make sure that the paths are also there for the gcc compiler and for vs code if they did not use again browse option to navigate to corresponding folders and this is folders where you would default install into it's time to check system variables open path variables and you should have parts for python if you don't have them you have to fill them in and you should also have parts for cmake for gcc compiler and also vs code if any one of them is missing just fill them in i also have them listed in my article don't open a visual studio code from the icon use developer command prompt in administration mode so right click to get into run as administrator if you select a path correctly if you type in code it will break up studio code visual studio code for you otherwise you have something wrong with your paths and you have to correct this now in there go to extensions and you have to install cc plus plus from microsoft and cmake tools from microsoft as well in cmake tools go to settings as there's a couple of changes in select extension settings and scroll down to add the following stuff in cmake path use cmake as your path then in configure environment use speaker sdk path and navigate to your picosdk folder that you've downloaded from the github scroll down up until you're going to see cmake generator and type in and make make files that's going to be your last change in that setting now close out vs code and open it again you can start your programming now you're going to need an empty folder because we're not going to use raspberry pi default examples i'm going to show you how to do it from a scratch so you don't have to compile everything now let's go over the files that need to be included so open a folder on your computer and then proceed to open it with file open a folder option in here once you have your workspace that's called workspace in this case the workspace is called test you'll need a couple of files first going to be sdk setup file for cmake if you click on that you'll see a lot of instructions about setting up sdk correctly within the visual studio code you don't have to edit any of that but just make sure one of these files is included in the workspace you'll need one file like this now second file it's a cmakelist.txt this is the file that cmic is gonna look at and try to figure out which files they should compile now we're gonna get back to it in a second for now we're going to assume that we only have one file and you just want to compile your program from this file so the file obviously in question is blink.c and the cmic lists file should look like this the only thing that you have to modify is the name of the project in this case this is a test and you'll have to fill that in here here and here and also you'll have to add the name of the file that you want to run since we only have a one file that's obviously no problem and just name it here and you'll can proceed to build it at the bottom now the situation changes if you have multiple files so if you take a look at my folder structured in here i have my main program which uses a header and the header itself it draws from the ledc file so i've opened these for you so you could have a look how they're being laid out in addition to that there is a folder and i have the header and the additional program file in a folder itself and obviously blink is still my main file so if you would like to to compile this you have to change the way the cmake is going to compile it so in order to do that you have to replace these files with the following structure now for headers so and this header is a indirect to the led you have to use command include directories and the name of the led now if you want to include project files like led dot c and the easiest way is to use the file option and then set a variable so this is a global variable i named it sources and i'm going to look at the folder called led and i'm going to look for everything that matches uh well it has a different name so but obviously matches the extension dot c so it's going to have a list of those files in this case it's going to be a single file led dot c and now i'm going to modify the art executable starting with the project then the main file which uh raspberry pi speaker is going to start running with and the list of all the files that's been listed in that folder that end with c and that's the way to add your um or compose your c make lists and once you're ready just make sure you select the gcc for arm uh as your comply and then hit the build now the build only is gonna be a couple of moments and you'll see that if it's finished with exit code 0 then you're good to go you can navigate to your build directory and you'll find in this case test.uf2 file this is the file that you're supposed to send to raspberry pi and to send it to raspberry pi disconnect it from usb press the button on raspberry pi plug it in it will show up as your disk drive and navigate to the directory when you had your file compiled so in this case test and build in here and drag and drop into the raspberry pi it will reboot and you'll be ready to roll you have to admit guys that was a lot to go through and i cannot wait for arduino to make rp2040 available in the arduino ide because it's gonna make so much easier to use cnc plus plus on windows computer until then you'll have to follow the satellite instruction to set up your sdk and kind of live with it i hope the update to arduino ide is going to happen soon because let's face it we just want to spend our time programming rather than messing about with the sdk i hope this helped you guys and you have sdk set up on your windows machine for both micro python and cnc plus plus and you can start programming on your own but if you wonder what i'm going to do next well you know how youtube works so i take advantage of youtube tools to follow me there or pick one of the social media listed in here so you could get notification whenever there is a new post or article on my website thanks so much for watching guys and let me know if you did it and i guess i'm to see i'm going to see you in the next video take care bye [Music] you
Info
Channel: NotEnoughTECH
Views: 34,435
Rating: undefined out of 5
Keywords: NotEnoughTECH, Raspberry pi, Raspberry Pi pico, C++, C/C++, C/C++ SDK, Micropython, Windows, Setting up C/C++ for Raspberry Pi Pico, Getting started with Raspberry Pi pico, getting started with C and Raspberry Pi Pico, Getting started with C++ and Raspberry Pi Pico, Getting stared with Micropython and Raspberry Pi Pico
Id: 5l3W-brnO7E
Channel Id: undefined
Length: 14min 13sec (853 seconds)
Published: Sun Jan 24 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.