Programming in Visual Code Studio using PlatformIO and AdaFruit

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back i haven't done a video in a long time simply because i've been super busy um so today i thought i'd give you an update on the sig rock i did manage to build it for the raspberry pi but it was very difficult to do i ended up building it in a raspberry pi vm under qmu and it took a long time to compile and get it right somewhere i have the archive i don't know where i put it but all i can suggest is if the sig rock is already in there or whatever version just use that version you don't really want to build this it's it's horrible um it's easier on the pc side but it still takes time to compile it runs through a huge test harness and that's where i ran into a lot of issues with it but today i think i'm going to talk about my new pet project basically platform io so i have visual studio code yes the one from microsoft installed into my linux a vm on my windows and actually on a raspberry pi and i've installed the platform i owe via the extensions right here on the right if you look on the left there's that little force through three square blocks of this block hanging off it this guy right here so if you go into here platform io there it is platform io ide now the reason i'm playing in this environment is because it has massive support for all sorts of iot boards so this little board down here the nano for example i'm playing with or the mega or i have plugged in right now which i'll just unplug the uno okay so one of the things i wanted was a different platform than the arduino ide platform now there's a couple of gotchas when you do this you have to convert your project into platform io the way they do things so let's go back up to here to our code now i already have a workspace full of arduino projects so i'm going to load that up but i'm going to add another project in is the demonstration so we go to file and i am going to open recent and i am going to open my arduino examples workspace so as you can see i've got a ton of projects here now i usually what i do is either through console or the file manager i need to check what the next arduino project i'm going to install into this tree so i put everything i do work on in work so we were in o4 and the last one was physical pixel so we have read ascii string now i'm a lazy bastard and i don't want to type so i'm going to just call rename first of all ctrl c so that i have the name of the directory inside of my clipboard i'm going to need it later okay now another thing you might want to do is up to you by default um platform io stores its projects in a different directory you might think i believe it's home user documents platform io projects i didn't like that so i changed it so if you go here to the platform i o terminal so now it says platform iocli and we go and run this command pio setting set project stir and where we want the projects and when we do that like so you can see we now are instead of this tree home documents platform io projects we're home well m work platform io i tend to do all my stuff that i want to manipulate in my work directory i save the documents directly for you know documents i really don't like the concept and this is in windows 2. i don't like the concept where your documents directory ends up with source code trees and other stupid like this it's really dumb right i if i'm going to code somewhere and i might go into my work directory and i might make a subfolder called c programs another one c plus plus programs another one python right and then it would have projects you get the idea i prefer to divide and conquer my tree and not plaster everything in certain areas anyway so once we set inside if we want to change our okay we don't actually need this platform io we can go downstairs there's a home button down here right there right it says platform io home when we bring it up this is what we see well we're going to do import arduino project so we click it first thing is going to ask us what board well let's say nano well there's three nanos here this nano right here without the string after it is the old boot loader and this one here of course is the new boot loader the real big difference i read is speed not the actual atmel on top nothing like that just speed the boot loader in here 57k is basically a bootloader here 115k speed so of course you can load code faster into the new bootloader than you can into the old bootloader but my nanos i know have old boot loaders on them so i'll pick it now i already have the arduino ide installed right there so i'm going to tell it borrow the libraries now down here in the tree we need to find that arduino project that we're going to import so if we go and look willem work arduino now examples now since i'm going in here all the time let's click this fat star right here toggle favorite okay so we know that these examples go directly to this folder and i already added the projects tree and platform i always another quickie although they also have it here yeah same thing right so i was in number four communication and i was last one i did is physical pixel so we're going to do read ascii string click on it okay and we say import what this will do for us is a number of things i don't need mr blink let's go down to the bottom here and number things and first of all we have our first issue what an ugly name for a folder and if you look at this where's the rename the folder doesn't exist so what we're going to do here is file we're going to close this particular folder actually we're going to close the work this is this is the tricky part if the folder was standalone we could close the folder okay remove folder from workspace we'll do it that way we'll go back to our explorer here and we'll back up and we'll go in the platform io projects and there's that gobbledygook folder i don't like it so we rename it remember that uh cut and paste i did o four dash control v enter okay now we go back into here and we say open folder and i will take that read ascii string folder okay now i noticed i just have a problem here we're not in our thing anymore we're not in our workspace so let's close that off for a sec here and let's open our workspace again i think sometimes visual studio could do this a little better open recent this guy here in this case i'm going to go here and add a folder to a workspace and do it this way there we go add now it's in here i also noticed that visual studio code likes to i don't know somehow remember vaguely that it had another folder open even though i don't have it open all right so we go down here and we go to source our first issues we have to convert this to a c file which is simply renaming it cpp okay let's open it up now you see there's problems here right five of them okay this is one i've come across and i don't know why it occurs um for some reason in the vs code cpp file it thinks these aren't comments upstairs here but if you do this save problems fixed go figure this is a random thing that i find that sometimes just happens in visual studio code and i don't know why have no idea and i don't feel like troubleshooting it now let's go back to string cpp here reads husky strings now one thing you could run into in your install and this is all how the intellicode intellisense path finding everything works for the visual studio code sometimes you'll get this effect where it says i don't know what pin mode is this line doesn't come up it doesn't say void pin mode unsigned into 8 blah blah blah right it just says ah what the heck is pin mode i don't know undefined if you get this case what you have to do in here is go include just like that save our file right because in the ino file you'll notice that uh it's not needed it's just simply part of the environment in arduino's ide that guy there so but this is more a classical c plus c editing programming environment so it's expecting you to follow the rules basically and sometimes this guy cheats at the rules this guy doesn't and will whine at you usually because intellisense or the intellicode engines go and say i'm sorry it's not there well that solves it okay now this cpp properties json the other thing you're going to find with it that will happen and i have this not on this platform so far but on my vm and my raspberry pi when i do that project thing and i import and stuff like that it doesn't auto fix this part right here in the path right there it has still has the gobbly blah blah blah nan omega blah blah blah path in there now there are a couple of ways to fix it they warn you not to edit in here but you can actually edit um you can go you know highlight the thing in question that this is the problem and go ctrl h like so and then do a replacement with what you really want in the path in my case i don't have to fix anything i already know it's all for read but this could be the goblet glue path this would be the regular path and then you can click this little button replace all instances of it then ctrl s to file and also a bunch of warnings about i can't find anything go away now the other approach this is there's an alien over here no he's not from mars he's from platform if you go into the alien right and you go to default project tasks and we're just going to shrink this a little bit here like that and we go to miscellaneous rebuild the intellisense index it rebuilt the thing okay now you might notice also sometimes we bump back out to the bash shell click your little platform i o so you're in the platform io shell right otherwise you can't do platform straight uh commands or whatever but that fixes the path issue generally you get confusion where it can't find or you've added something into your project tree and it doesn't know where it is you might add something into the lib directory or you might add another source file or you're adding something into the clue directory here header and it can't find it over here even though you did you know let's say angle brackets header file.h angle bracket right but this will help you fix now again comments not permitted in blah blah blah see i'm going to have to look into this but this is a very annoying thing to have happen right so it's saying analog read serial so it's complaining about another file completely right so if we go to o1 analog read serial vs code this cpp it's complaining about the same damn thing right there fix i have hit save a few times right let's go back down to her read ascii one where we were okay so change the file to cpp add this if you need to the include statement correct this if you need to or have it rebuilt okay now this pio directory here deals with libraries now we need a a set of projects here to demonstrate this so i do have it it won't run properly but because i'm not on a raspberry pi for this okay so i'm going to close this workspace off and i'm going to open another workspace work platform i o projects we scroll down we have projects code workspace here okay so what this stuff is here this was a bunch of um rgb matrix demo code from a library called rgb matrix something something something something um this is all arduino code but we had to do a few things now this pio directory for example as you can see it actually has the lib depths in there and then based off the board it has the adafruit libraries the rgm default matrix panel library the adafruit adafruit blah blah blah now you're wondering well in the arduino ide there's a library manager well there's a library manager here too ta-da a library manager right and we can go to install for example and we can say add a let's see no yes maybe well uh what's the libraries this guy i find a bit finicky finding files i'm not sure why um uno oh case sensitivity here add a fruit let's see we can find the added fruits nope well for some reason it's not showing it up that's very disappointing uh why built in no installed search for everything filter libraries my name registry add a fruit let's look in the master database okay so out of food bus io okay so for some reason in this gfx demo it thinks it's not installed now this could be because i cut and pasted this whole directory so something might not be right okay so we'll add it to the project we'll select the project uh that's not the project i wanted okay now definitely i have a screwed up tree somehow so i'm going to try the other alien command in here default advanced non-advanced miscellaneous update project libraries and i'm going to try update all just like sure so go back to here and the problem is i'm not seeing all my projects right so i might have to fix this on this machine let's see if i can do this rather quickly remove folder from workspace remove folder from workspace remove folder from workspace workspace workspace workspace workspace workspace workspace workspace okay so let's us add a folder and we will go here to projects and i will take the matrix one and i'll say okay and then i will save it as a new workspace uh save workspace as and we're called rgb workspace save okay so let's add a folder to the workspace the demo add a folder to the workspace plasma folded workspace other plasma the sizes on the end are the panel sizes 16 by 32 32 by 32 i actually got this working up to 64 by 64 actually i have all types of panels here scroll text and i might have to do this with the arduino but i'll do that later but i just say add scroll text yeah text colors i wonder if i could do an all multiple folder load uh let's shrink the folders so text color texture success test shapes 32a64. did i get them all uh folder to workspace let's see i got the the matrix one oh there's two more right there the color wheels add them yes we can do multiples okay so let us check again the library thingy because um i suspect i blew it up so we know that in pio we have the lib depths blah blah blah so let us go back to platform io's home and [Music] actuality i might have done this wrong sometimes you have to load it through there um let me do something here um okay we're gonna go this way open project projects color wheel open color wheel okay let's see if we can open multiple projects in here that'll be cool if we can do that so color wheel no it's going to go right away into a color wheel directory okay home open projects so we did the two color wheels let's do that one so i did the panel gfx let's do the plasma [Music] you think i keep the home page open but it doesn't doesn't it doesn't plasma plasma 32 shrink the windows open the house open project you know i'll do all this and it won't work uh scroll text open text shake the windows do the home open the project go to the projects i did the scroll text test colors do the house open the project do the projects test shapes open house open the project this is just adding all the stuff back into a new work place basically uh [Music] i just did test shapes 16 by 32 so test shapes 32 by 32 enter one more to go window open project projects that shape 32 by 64. okey-dokey let's see if our library stuff works this time um home libraries installed there we go so i was correct cut and pasting the stuff i probably missed a control file that was in another directory because i do know there's that dot platform io and it might be keeping data about that so but there we go so if we do gfx demo for example and we look at pio libdepps uno the reason you see a three here is because you got three boards all have this library in it okay cool thing about this is if you click on one of these libraries let's go do the rgb matrix panel one they show the examples these examples come out of this library this color wheel for example right see all these guys they all are here i just took them out of this demo directory and made them as projects in platform io which is kind of handy okay but you can see these are the two files this is the i know i had to convert the ino file like i just stated before into a cpp file okay now look at all the orange that just happened right now yada yada yada yada it's complaining up to yangyang vs code is complaining if we go to cp properties json right you see i believe let's give me a console here for a second so it says 65 problems okay so color wheel okay if you actually wait for a while this thing will actually eventually catch up to all this or you could just click on the properties page and guess what it fixes itself because it's re-parsing everything so if i click on color wheel vs code cpp it corrects itself but the path it doesn't like the path matrix2 source that's wrong right so we know that that's not on the that's not the right path this is where i say this is a problem so let's see if we can rebuild this by our little alien here without have to do any edits so miscellaneous uh see this is where the problem i know it's not matrix 2. if we bring up to our platform projects right this is uh this is color wheel program 3232. color wheel program 3232 okay so if we right click and say rename ctrl c put it in our clipboard throw that away for a sec and we come over here and we double click on this matrix to go ctrl h ctrl v all instances ctrl s oh look color wheel's corrected now right color wheel gfx demo this one's wrong let's see does it have the rom in this case just needed a refresh of opening the file and actually if you could walk if we watch this it might actually self-correct itself over time but i'm an impatient person i know that this should correct itself like so i think whatever timing loop is in here to actually parse these files and check them out is a little on the slow side look at that it cleared a whole bunch of them in a foul swoop let's go to this one here and see what it's complaining about again wrong property so it's test shape 3264. i'm going to go to dolphin here and i'm looking for test shapes 3264 right there i'll rename i'll ctrl c put it in the clipboard and then i'll go over here ctrl h control v fix them all control s now all our stuff is correct so you can also manage boards from in here but this gets a little tricky let's say we want to add the other nano the old nano sorry the new nano so we go find mr nano so we want to add new bootloader nano uh whoops did i click one clicky uh wrong i think i did let's do this again boards new nano you know testing debug on board get it now well it puts it up on the web thing um what we want to do though is copy to the clipboard i believe this is what you do so so we need to add this board to our code and there was a button where did i see that again okay installed embedded desktop frameworks updates no we don't care about any of that um ah our damn devices uh platforms no boards um projects uh here we go i think this is where you did um let's see find our gfx demo one there here we go so here's the tabs for all the boards we're going to add a configuration now there's as i said there's two ways of really doing a lot of things in here this one is the way they would have you do it so environment name we're going to call this nano new okay to represent the new bootloader in the option we are going to pick a board board control v okay we have that but we're not done yet click for another option we need a framework and this is the tricky part you have to remember what frameworks are first is what are uh think so i usually go to an existing one like the uno actually to the platform i o file itself where you so platform framework so i know it's this one for arduino so home v arduino so we know we need we have a environment we have a platform so we have the framework we need the platform platform packages and one other little bit oh i'm sorry we need platform not platform packages so this guy here just deleted so we've got three of our four lines that are going to be in this io ini file but we still need this so lib extra dirt right so when you type up here you just go looking for lib extra durs like so okay save it there we go now it's in here you might think wow gee that's a lot of work it is you could also do this as i said clone clone clone this is i find a lot easier just like this we know uh we need to give it a name i'll go now and board it just happens to be practically the same name with the word new on the end everything else is the same we don't need this block anymore so now we have old nano and by the way i think i'll rename this nano well that's we better do that and this nano better be labeled that one there we go so we got the old bootloader nano the new bootloader nano the uno and the mega ctrl s oh something implav and there are two saves there's a control shift k and then an s to save without changing the format and then there is a control s that saves in an auto formats code if you don't want the auto format code crap if you go f1 i believe it's format no no no what was it formatter save without formatting hit this little wrench right here on the end and reset the keystroke okay so i changed the previous keystroke to just control s the reason for that is the damn json files um this is about kind of a bad example but sometimes when you're writing these damn things people say well do it this way do it that way i actually prefer this where my brackets line up right like that it won't matter in this particular file because it'll probably get reset on us like when it re-parses and decides to reset this file this will move back up here but if you have custom json or stuff that doesn't do that doesn't have this warning don't write blah blah crap at the top you're going to find that maybe you don't like the formatting and this by way applies to any of the file types the c file types the cpp file types the python you might not like the way they do it so let's just exit this and exit this and bring up the gfx demo cx code so when i had this running on the vm and pi the only thing in here was i have first put that was this and it complained bitterly about not finding this stuff wire spi rgb makes panel adafruit i2c device right and the custom header file smiley tongue right oh yeah this is another thing this particular demo out of the thing the only one will not fit on an uno you could think you flashed it to the owner and nothing will work properly but i went and added all these and solved the intellisense and telecode now in theory this should not be happening because cpp properties states look i found the wire directory i found the chorus arduino i found blah blah blah blah blah right see all these piyo lib depths right here on the end right rgmhs panel adafruit gfx library adafruit bus io in theory this thing should have found those headers where they belonged right what i found was not so oh there's another property you can set i have to find it but notice how it closed the um source code window in favor of the json window now it's opening the the code window and getting rid of the json window you can stop that from happening you can then have both windows open on the top i find that a bit annoying it thinks it knows better than you usual crap but yeah and before you know having we can check if this is going to blow this thing up okay by just checking if we pull a problems out of it it looks like no in this case on this platform for some reason not the vm and not the raspberry pi it's finding these headers so i don't have to do that but in case you you run into this in visual studio code where damn it it's not finding the headers you know they're there right this is all about how this parses everything right how it determines path and this gets more nasty in the python side of the world on imports than it does on this side and this by the way is a humongously large demo for the rgb matrixes i won't go into it much but it's kind of cool if you haven't seen matrix panels um let me go get one okay so let's just park this window out of the way for exact the desktop this is an rgb matrix panel okay you have uh input output meaning you'd chain these things like so off and when you look at those big led video walls you see put out there are just a ton of these things not this particular size because this is what's known as a i believe a p6 the p is the pitch between the led dots in here joint doink so if you were to put a ruler on here and i happen to have a measuring tape and we were to measure yes six millimeters so this is a p6 panel but guess what in our office we actually have what you would call a p 8 that's right 0.8 pitch leds so and the pan the wall is capable it's like about seven feet tall and roughly uh i think 12 feet wide something like that 14 feet wide um solid wall um in those cases those walls are not driven by these hub connectors per se they're actually all big panels with self-contained units and stuff and then they all link to a big driver system that controls it all in our case we have two different sets a one that's capable of doing 4k content one that does 1080p so two of them to do 4k and the wall is split between the two and then they're they're joined together in software to make it look like it's one seamless wall and then the other are the walls divided in four chunks uh usually a grid one two three four like so and it goes and drives each section and again they're all tied together logically and you get this effect where it looks like one big wall now you can get these panels off aliexpress freaking cheap these days if you want to play with this stuff so a panel like this which is 16 32 this is only like about eight bucks to get this panel to buy a 64 by 64 p 2.5 panel for example you can get a really nice one from uh adafruits it's about uh 35 bucks or something like that but on aliexpress it's about a generic one is about twenty dollars eighteen dollars something like that canadian and i have the adafruit 64 by 64 i have my generic 32 by 32 i have this guy and i have more coming i actually bought some 64 this way 128 this way p2 panels that's two millimeter pitch that's even finer than the 2.5 adafruit panel so now you're saying well how do you drive these things well that's the code on the screen and there's a couple of ways of doing this you can take this this mega for example and you can wire it the wiring pattern is on adafruit site and you can connect it to this but one key thing about all these panels you need power so i have over there i have two power supplies over there that have um um they're like five volt one is i think five volt 12 amps and one is five volts six amps a smaller one but you can get these things off aliexpress pretty cheap too they're they range anywhere from eight ten bucks to about 30 bucks depending on the amperage and the voltage you want in these case all these panels so far i've had are five volts panels right now they say that a 64 panel by 64 panel could draw as much as seven amps well one thing i've noticed is i had the panel with adafruit's rgb matrix portal m4 this is one of their circuit python gizmos okay so you plug the panel into this header here kind of like you look at this thing you say input and you go like that that's the idea i might have it backwards actually i cannot remember on this panel um because for some reason this this thing is not keyed so it could actually go this way also let's see yeah like that okay and then the the added fruit one when you power it with usbc just make sure that the usbc power that's coming in here has lots of power okay now usb2o ports on on a hub or something like that they're limited to like 500 milliamps unless it's a charging port right or the the they have now different colors uh black is usb2o blue is usb3 yellow or even red those are power and enhanced ports they can provide more power the other way to do this of course is you just use a raspberry pi 4 brick you know five volts at four amps or something like that you know the wall warts uh kind of like this guy right here you know so this guy here is five volt two ounce this is a bit wimpy okay because it was intended for an older raspberry pi 3. you can tell because the link here is micro usb 2. right what you really need is usb 3 uh effectively i have that cable going to a usb 2 hub down here so but given enough power and you plug this all in and this particular one this big silver thing on here that's wi-fi so you can actually address this over the web in your hand and push stuff by web pages to this panel that's one way of doing it sorry that's method number two of doing it method one is direct you know gables right method number three is another concept from them this here is an arduino arduino hat just specifically for hub 75 connectivity so what they've done on this thing let's see if i can get a fairly good put you can see that all the pins here on the thing are actually connected and if you actually trace it out they go to certain pins on the arduino both sides now you do have to do a little soldering with this so i added this part the switch the extra 5 volt input that you might need i they didn't have the put this on but i put this part on because i needed another ground pin and there is one in here so they would have you line up the hub 75 ground pins these green guys here plus depending on the panel you have you might have three address lines four address lines or five address lines so the 64 by 64 pound for example has five address lines but the 32 by 32 has four address lines and this guy here has three address lines but it demands that the fourth address line d be grounded so i made this guy here with a jumper block if i don't put anything in here right right and instead i go from here to over here to the ground i've got my extra ground unless i do another panel i need that extra address line i just jump her over these two and voila the thing becomes address line d so you get a ribbon cable i don't have one on my desk at the moment and you put a ribbon and it's keyed there's a key right here where my finger is so this goes on top of a raspberry pi sorry i mean arduino so like this so now remember what i said this particular demo the panel gfx demo none of the others just that particular one is so packed with code you'll overload the arduino unos you need to put this on the mega now the funky thing about this the actual pins that get used on here you could make it technically work on here because if you look at omega like so this part of the pinning in omega is almost identical to an uno but the code would have to be modified because the code uses some stuff over here some stuff over here okay so what i'm going to do and i've ordered and i don't have it here yet is i've got the hub 75 style standard ribbon thingy connector and i've got a cats coming for magus so i can build this on here and i have over there i just don't have it over here i have omega hooked up to the 32 by 32 panel running the panel now there is a fourth method for doing this also from adafruit so far all we've done is we've messed with arduinos now raspberry pi's and let me go and get mr chrome here for a sec see if i can get chrome oop chrome's not even running better not do that that's a bad thing let's go get chrome up so if we go looking on comb and we want to find add a fruit rgb matrix pie matrix hat plus rtc for the raspberry pi so let me get a picture of that for you okay okay let's show the desktop again so this is the panel i have basically but i think i'm not sure in this demonstration whether they have this panel is the um 2.5 panel or not yes it is uh no brass m 2.5 this also includes gpu ribbon adafruit argumentation arcgis by minikit okay so no there's no panel on this but the 64 by 64 panel kind of looks like this okay now that piece up there you have to do a bit of soldering so let me see if i can find a picture of it so this is what you get okay this piece up here the the female header goes actually underneath the board it's going to be the piece that plugs into the raspberry pi this is the extra 5 volt right here and this is the hub connector that goes over here now this is a rev c hat you can see the little why were you always doing this i don't want you to blah don't you hate it when you have auto zoom there's a little c there on the thing i i try to point at it but this stupid thing is zooming the picture all the time open image new tab there so this right there this c revision what it does this is the e address line setup right here so you will have to solder eight to center now i really wish to add a fruit instead put a jumper block here you don't really need the time clock but if you do put it on the thing you can it just takes a particular battery cell uh 2220 or something like that i can't remember the number the other thing you might want to do on here there's a quality thing on here where they want to have pin 4 here and pin 18 here soldered i highly suggest instead go to your thing for headers for pinned mail pin headers and just put one in here and one in here so you could just jump her a wire across when you need to again i really wish uh these guys would have put that as a jumper block in here you know rigged it somewhere in here where they just had a jumper block if you jump at this eight and eighteen are sealed if you jump right over here on eight and center that way you can take it off and take it on anytime you want so you build this thing this is the bottom of it what it looks like they give you a gap for the um ribbon for the camera just in case but i i'll warn you this when you run any of these matrix stuff like this on the raspberry pi it's very very sensitive to what you run on the pi i had to turn off the desktop and some other stuff including the onboard audio not that i cannot use audio i just have to use it now through a usb audio device not the onboard one the thing is so sensitive to timing that it'll look like your panel doesn't work right but this is method number four and it works quite well once you understand how this all goes together so and there's where it looks like when it sits on top of a pie okay now if you supply this thing with its auxiliary five volts these or these cables just like on this one let me turn off the chrome for a sec just like on this one i've got the power connected here on this one so it's actually getting the panel power from this usbc port right there it's the same thing with this right and this one if i supply you know to a from a dc supply of five volts in certain amount of amperage i can power the panel from here like or you do it from here like you you put it on here like so you put your five volts in here this picks it up this goes to the panel that's one way or like i did i have standalone power supplies doing this so and that code drives all this so all this code here these are just samples and i fiddle a bit with the samples um i even got um i changed things where i figured out a lot of ins and outs of how the code worked it's kind of tricky at first because you have to actually know panel sizes how panels work right you have to really pay attention when they tell you that the mega panels are arduinos these guys use [Music] clock 8 for example here in the code you have to add a defined d in here for a3 put it in here into the matrix because that panel required four address lines right in theory you could add e into here and get you know the fifth address line so so now this guy here the i saw just below the code window and the gap this guy here he uses circuit python instead okay now do i have a usbc cable here give me a sec i need another another usb cable okay so we have it somewhere down there there we go this guy usbc so and i happen to have a usb 3 hub here and we'll plug it in and what happens with these units is they actually have storage on board so you see the circuit pie i'm going to mount it okay so it's mounted now i'm going to close this workspace off close workspace okay and i'm going to open a folder so what we want to open is that let's see other locations computer media where is mr media there it is will m circuit python okay so the way this works is yeah we'll open that workspace file there we go so this is all python code um it's derived off micro python and adafruit morphed it into um circuit python so all the stuff needed to run something is on this unit okay code is the default code where you run all your programs from now you might notice i have code0081 because i was messing around big time okay so first thing i see in here and i need a shell new terminal i have 11 problems detected so what we have here is the notorious python linter whining and complaining and complaining and winding whining both these things are complaining so pylance is complaining and flake is complaining we're going to fix both of those things so what we want in here is settings json i believe is what i want and i need my console first bit so i've already fixed this before in another project so let me see if i can find it yeah here so this was a rgb library for the raspberry pi and what i'm going to do is go to bindings and python samples no not quite where did i store that oh this is a fresh copy so we need to be in 2 182 168 42 [Music] 60. oh just a sec we go to the black stream because i have to type secret super secret stuff there we go so bring the desktop back and the top cam back there we go so this is the vm on the windows machine we're going to borrow it for a sec because we need to get something out of it do i have the other python up i do let's just check yeah okay i'll get it from another spot too um so this this visual code studio is actually remotely connected to my pi and i'm going to dip into it for uh some stuff what i need out of this thing is not that file i need i need i need settings json okay here we go in pylance to fix the pylance errors this took me a while to figure out and it was annoying as hell see this one auto complete extra pass an analysis extra path right and this is the flake so what we're going to do is we're going to steal this chunk of code here actual still the comma two control c and we'll go back to the other one no not the console window william the other code this one so we stole that code out of settings.json under our open projects really what it is is this stupid file here we need the python [Music] vs code not system volume information i'm pretty sure i can shove it into here not quite um we need a spot to drop this in our problem is we need to fix the path well i can take this part one this one here the flake args that's an important one come on cut it out ctrl c so we go back to this one here and share in the right settings um it could be that flake args is not installed and this guy quite right hmm problems oh we're down to one problem now oh see this is the part where i hate about the bracket lineups this needs to be down here i believe actually and that needs a comma there we go like so okay so basically we got rid of the uh flake uh eight our uh linter all these all this really does is say ignore all these types of errors or warnings or whatever you wish to call the dumb things i mean i don't i don't understand why they say well you have to have a new line after the end of the file oh give me a break this is not windows where everything has to have carriage turned line feeds at the end so we basically fixed the thing now it's the same thing with the um this is the other part in python that gets annoying so you see these these autocompletes here this is a pylance problem there are two python engines sort of language engine so to speak in visual studio that get used jedi or pylance and you can actually check which one you actually have so you go pie lance right microsoft pylons perform rich language server for python and vs code except when it doesn't want to work right which is usually you get these stupid intellisense and telecom warnings saying i can't find something an import is missing blah blah blah blah blah all this stupid crap and it actually doesn't exist that way so in our case um on the local machine here we look at code so it's complaining here about something new this is flake so we need to find i thought i'd fix this already and jason's uh let us have this rebuild this did i have to put that in cpp or settings i can never remember [Music] vs code settings yeah yeah i had it flake args in the settings phone and i got rid of it over here there now see the stupid thing this doesn't do this wrong over on but we can fix this i hope so why aren't you picking up the settings json file again let's go and intellisense reset the intellisense database okay f1 intellisense i just want to make sure so they are using flake eight let's change this to pilot let's install pylint instead i always found flake not working very welly okay so we're down to three in code problems uh missing imports the classical problem board we know it's there so what we're going to do is in our settings json file here right here we are going to add from the other one the one of these parameters these parameters here but we're going to modify them a bit i have a feeling the path uh it's just kind of wrong so we'll ctrl c this and we'll go over here [Music] and we'll ctrl v it and we'll get through the last colon now we have to straighten the paths out so it doesn't know what this is expected a comma oh yeah of course duh coma okay so home will m work code python no this is not what we're looking for in this particular code space we need the path as i said where is it home route media will m circuit pi this is the path we need so ctrl c and what we need in here is control v and i don't think i need these guys we'll find out in a sec and here ctrl v get rid of this part ctrl s so we still doesn't like it board display item frame buffer okay so we need to go a little deeper and those are actually in the lib directory should be in the lib directory so this is the part of python icon i hate it's like very annoying so when we go look at code pi we want to import board where does it get bored from mole board where are you coming from so on the 211 this workspace this is not the code one this is uh this is the rg matrix space do i have no i don't have i have it over here so i can't do that um we need we need we need we need we need to find these so font bus device display i o matrix portal portal base graphics network devices the wireless cup that's what that is graphics matrix no we don't need any of that portal base no no that's a compiled phone well that's kind of funky we're missing something that shouldn't be missing not good display i o though i could think i could fix that one um add a fruit io problem is where is that stuff um cd media [Music] um matrix has it and wi-fi has it uh what was the other one oops not that display io [Music] um see this is what i don't like about by pylance if i switch the thing i think i can switch this if i switch it to jedi i think the problems will just simply go away i've actually put a very displeasing survey into them about this um sent uh what was it um where was that um so linting pilot enabled flake where was the other one there is another file that contains oh damn it it's not in this one probably so many possible settings um [Music] language no come on guys now oh i have to look this up this is stupid where is my chrome uh visual studio code change python line good server launch no logging level workspace tags no code telesense engine settings language server this is what we're after actually just going to park this on another window for a second what we really want is python yes we're on pilots we need to change that oh this is starting to annoy me cord gets getting caught onto the keyboard c it's not quite what i wanted there python language server we don't want that one let's change this let's see what happens now go back to code um what do you mean don't like my comments what are you bloody well complaining about now i need a notepad oh we need a notepad notepad notepad no utilities give me k right please control v all this is no go anymore ctrl c delete delete okay ah stupid flake eight oh man alive i thought i got rid of all that uh i think i need this chunk now back control c home comma tell us oh what a mess this is what i really hate about pylance and jedi get them wrong and it's all a mess hmm and then for yeah yeah pork board could not be resolved yeah yeah yeah that's all default settings you're complaining about crap in here correct strings yeah yeah okay that's who cares get rid of that um what we care about is this one undefined false on this python linting so you don't like the lint variables okay fine okay i don't need develop settings go away uh policy ball well that's another freaking bug i don't have an unsafe pile yes stupid smucks no thanks select the python interpreter can we have the correct one please okay so what we did is we lost the mount point okay uh usb key circuit python it's still mounted retry so why can't we save to that directory then one problem it's another one cd media william python lsfla well that's good hi i'm empty now uh something happened there last circuit python there we go all our codes back that's fine okay uh let's add the folder back again yes another chunk of crap that has to be installed and we're back to flake again so i wonder now i can get rid of flake no [Music] whoops i want those guys control c can i not put these back in here come on g you don't like these anymore holy e226 ah come on give me a break it's probably because it thinks it's in one form of the code is in another oh look rgb matrix is found duh so we don't care e221 let's add another one into here comma e221 control s there we go comma e 2 2 6 control s line break w504 w504 control s trailing white space w291 comma w291 keep adding these in now we're back to oh e222 multiple space left for operator yeah whatever e2t2 now we're back to our missing imports i'll have to have a look at this later this is really stupid wow save all there we go okay so now this doesn't work over there on that project so why are we missing the board so i know that's adafruit has changed the way they bundle things so if you're working on a project like this now they changed at the top you can actually do the code samples you can actually get a complete zip you can drop in place in your circuit uh pi directory python directory like this and it has all the files you're supposed to need now they just just did this like it's really new um but this is the part i hate i think board is there it's just that it's not finding it properly so now we're doing magic python with pylance so i think we're doing pylons um where's my editor again so let's put that chunk back in here comma control b okay so oh right stupid json try to make things pretty and of course it doesn't like things don't last there we go so our paths are not quite right what if we add um a little bit here you know i do an import here see no board no it does the intellisense is not finding you can see right here it's not finding it so um whoops i need the browser for a sec where's mr browser there is circuit python not finding board import board let's see what they have here windows 10 windows 7 macos drive issues now he's right there starting trace of snow no no [Music] um no not helping yeah that's what i know the module this [Music] way i have the most pretty well current circuit python so that's not the problem so hmm just check that yeah it's right there so hmm it's probably something i'll have to debug on this this particular machine because i know it works uh if i plug it in over there on the raspberry pi because that's where i was using it but this is the python hell that you can go through with imports it's just annoying i know board display audio frame but for port b yeah of course not i just put that in there right but this usually can get solved by these types of lines right here with pylon it's just the problem is we're not finding them at the moment i wonder if this is missing oh is something that came up this came up with um someone else had a problem with this it turns out possibly what we're missing here is at the python level um pip 3 install is it blinker hmm python 3 pip install blank yeah adafruit blinker so let's try this pip 3 install uh add a fruit blink some of the stuff actually comes from the stock stuff now let's go back to the shell and see what happens here no not the remote one local one i'll save all uh let's just open code again um we might have to restart the environment after you do that like that so so let's go open the workspace again um recent circuit pie your fireworks face open that up better so we've solved the board issue okay so now we need to solve the display i o issue because it's actually not in the the circuit python's lib directory on the device it's actually in your os good thing i remembered that so we need to do the display i o um display i o oh okay so again uh we should actually be able to do it here too um pip3 install add a fruit blink display i o and then we probably want blinky a not splay io but frame buffer io see nope not quite uh exit this let's come back in again and file open works resend workspace let's see if that solved everything nope we still one more to go frame buffer io hmm whose uh add a fruit unless this is a stock one ah add a food circuit python frame buff let's try that you know i should be able to install all the circuit python stuff into here out install circuit no python 3 circuit now hmm let's just see python3 uh install circuit python installing circuit python that's the library bundle okay [Music] oh come on guys i hate propaganda pages uh guys i want the secret python yay i know all that uh [Music] no this is okay let's just blow the raspberry pi's let's see yeah i've done all that let's try this that's much better he said we don't want the raspberry pi blinker we don't need any of that let's see now um this guy here close it here start it here again well recently do we still have an error with the buffer i o we still do we're still missing a python library installed all that but it's not working okay um okay adafruit install a real or virtual linux machine native linux okay yeah i'm not doing a mac os so native linux okay no that's installing ubuntu you dummies and there's got to be a missing piece here apt install python 3 dash no um we are missing one freaking library one i don't want to do arm i just want to do that missing library [Music] install hmm apt install python three dash add a no python dash no add what the hell it's all in the pie pie okay um pip three install adder ah platform tag pure io python shell blinko platform detect install put that in just in case that okay those are all in that leaves the frame buff fasteners feature is there one called buff in here nope frame buffer aisle oh come on damn it there's one library short of a load here [Music] missing import no i didn't mean that yeah yeah yeah download the library bundle [Music] and book code where the frick is getting frame buffer io from i know i'm missing something god damn it this is stupid [Music] uh oh brother you know there's a real problem with this freaking google and the bad sights now the fishing attempts no i meant frame buffer i o google not frame buffer okay let's try this one pip three installed add a fruit dash circuit python dash frame buff okay let's see what happens now crash and burn time bring this open wow open recent workspace please thank you star come off it oh man let's try this again oh nope recent still doing it this sounds like this is the stock frame buffer io not adafruit's version of it but where in the hell is it the package um nice stupid google where in the hell is this digital i o where in the hell is this library oh come on with the bad sights man where in the hell does it come from i hate freaking pdfs full of crap i wonder let's go over here no this is doing arduino william william william forget it that's stupid e303 ah go away oh blinker cone adafruit control f frame buff no it's not there not there oh boy why does it work over there on the raspberry and it doesn't work over here ah this is just crap um [Music] python 3 what provides frame buffer io definitely in the micro python one stack overflow see what they have to say [Music] nope no good and the dumb thing is this thing all works on raspberry pi just fine i wonder um [Music] electron let's go to the pie pi at 182.168.211. um console [Music] uh okay okay um appt cash search for frame frame buffer python 3 sdl2 virtual frame buffer so we have a python sdl2 stl2 we have these guys python3 sdl2 and python 3 xv frame buffer wrapper [Music] now what is the method pip 3 show installed no that's not what i want guys why do you guys just freaking do this all the time pip 3 show install packages now let's install package thank you good old active state tip three list what we're interested in here is e flash points into the blinker blank tee jenna and you're fairly easy first thing hmm okay i think i'm gonna call it here i obviously got a problem on this particular box it's not finding things i'm missing stuff don't know how to get it in yet did fix 2 board and display i o but still don't have frame buffer i o and it's supposed to be here so i'll try again later i have to research this where is my thing okay so this will be the end for the moment
Info
Channel: Will Merkens
Views: 742
Rating: undefined out of 5
Keywords: Hobby, Electronics
Id: gC7fB4-mugk
Channel Id: undefined
Length: 127min 16sec (7636 seconds)
Published: Wed Apr 21 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.