- What I want you to do now is walk me through installing
VS code on my PC okay? (record scratching) - Okay, okay, okay. - Have you ever wanted to use VS code to program an Arduino board? You know it's possible. Well today I'm gonna show you
how to do it with this guy who doesn't know anything
about VS code or coding. Let's do this. You can learn this. (upbeat music) All right Josh, you got a Mac right? - I do. - Okay, so let's go ahead
and share your screen. And go ahead and open up a
browser window, Google, whatever and just search for VS code. And it should pop probably
one of the first things that pops up, there you go
you've already been to the site. So go ahead and go to VS code. And then there's like multiple
download places right? But I think the easiest
one's just right there on the front, big blue
button there download. It's gonna self detect
or it's gonna detect which one you're on. If not, you can like
specifically select your machine so you can save it to
the desktop, that's fine. Should download a zip. All right. And then once it's done you can just double click that zip file and it should install it for you. Cool, extracting. Sweet. All right now you can, like
you can do it however you want. Usually I'll take, you know I'll take that and I'll drag it to my
applications folder. I don't know if you've got
your applications folder pinned to your desktop or not, it doesn't really matter but. - I don't. - Okay so go ahead and
double click VS code and it should open. Double clicking is hard I know it's like-- - I know. (Josh laughs) I know I'm gonna open, I'm gonna trust. - All right trust it man.
- Trust you man. - Trust it, it's Microsoft,
what could go wrong right? (Josh laughs) All right, sweet. Yeah and just make that full
screen for us if we could. Okay so you've installed VS
code man, this is great, nice. - Nice. - Okay, so now the next
thing we're gonna do 'cause we're trying to get
this to work with Arduino, is there's an extension
we need to install. There's actually a couple extensions that we can try to get the
Arduino to work with VS code. I'm gonna use the one that Microsoft creates, makes, and manages. All right, so over on the left hand bar there's like a work bar there. I don't know what the
appropriate name for that is, but at the very bottom there's a thing that looks like blocks, you know like little building
blocks, that's the extensions. - Okay.
- So go ahead and click that. And extensions are something like that you can add to the IDE to like extend it essentially. The VS code IDE.
- Okay. - And so what you wanna do is go to, so it's already showing
you for recommended like some Arduino stuff, which is cool. So go ahead up at the
top there's a search bar, click the search and type in Arduino. There you go, see that top one? It's got a little blue check
mark where it says Microsoft? - Yeah.
- Now click install. It's gonna go through a little
installation process here. - Okay. That's an old logo there. - Yeah, yeah I guess it
is kind of an old logo. It's kind of a conglomeration of, yeah that's totally a
old logo, you're right. All right, notice that it
opened up your Arduino IDE. And that's probably
something important to note, if you want VS code to work with our, you know, with your Arduino boards you also have to have the
Arduino IDE installed. Now this is a little caveat that's rather I don't
know, semi-technical, you there's actually a command line tool that Arduino makes that you can also use, but we won't talk about that right now. - Okay.
- As long as you know, as you just gotta have
the Arduino IDE installed to use VS code with Arduino. - Gotcha. - All right, sweet. So you wanna go back to the, there we go. Okay, sweet. So look, you've downloaded
this Arduino extension. Now I want you to notice over on the left where it says installed, see where it also installed a C C plus plus extension in there? - Yeah.
- All right. So that's just stuff that kinda like, you know sometimes these
extensions have like dependencies and they'll install some
other stuff for you too okay. And it can happen, like you install one and then all of a sudden you've got all these different
extensions installed in there. - All right.
- So now what I wanna do is I want to open up, I like
I wanna do a smoke test. I wanna like actually test that everything is working here, okay? So what we're gonna do is we're gonna open up the
Arduino sketchbook folder, okay? And that's gonna be the
space that we work in. So we're gonna open a folder in VS code and it's gonna be the
Arduino sketchbook folder, which is like the folder where all your Arduino files get stored. So go ahead and I want you to go up to file at the very top, you know, it's gonna be like the dropdown. There you go. So go to file. And I want you to go to open folder. All right, now I want you to
find your sketchbook folder, usually it's documents. Yep, there it is, Arduino.
- Okay. - And then select Arduino. This is generally the sketchbook folder. All right, okay, now go
ahead and click open. All right, great. So now I want you to go in the top left and there's like a two pieces
of paper on top of each other, it's in that sidebar, not at the very top. Yep, there you go. - Wait, two pieces of paper? Oh right there.
- Well, yeah yeah that, I don't know what do you call it? - I don't know.
- You're totally right, I just got scared 'cause this
kind of looks like paper, but a bit more like a Rubik's cube.
- Okay okay no no cool. All right, yep that thing. That's the explorer. So click that. So now see where it says
Arduino is at the top? That's like the top folder. And then inside that you
have your libraries folder, those are like the
pre-installed Arduino libraries. So go ahead and click that little arrow next to libraries to make that small. Okay, great. So now what we're gonna
do is we're gonna test that we've got everything set up okay? So I want you to go ahead
and create a new folder. So if you go over to the right there should be a button
there to create a folder, I think there's usually
a dropdown suggestion. That looks like it. Yeah there we go.
- Oh okay there we go.
- Go ahead and click that. And I want you, did you do it? - Yep. - Oh, you know what though? Here's what happened. See how it made the
folder inside libraries? We don't wanna do it inside libraries, so actually just go ahead and put your mouse below Arduino. So open up Arduino again, put
your mouse below libraries, right click, and now say new folder. - Gotcha. - There we go. And now just call it
smoke underscore test. And a smoke test is when like you're just, you're trying you're making
sure something works right like you've got it all wired up correctly. Okay so now what you're gonna do is right click on smoke
test and then say new file. And now I want you to name this smoke underscore test dot INO. Now the reason you need the enclosing file is because the Arduino IDE that's like just how
it organizes its files. It's got an ENO file
inside an enclosing folder of the same name, right? When you're on the Arduino IDE you don't have to like do that, you know you don't have to make the folder and put the file in it. Like the Arduino IDE handles that for you. But we're in vs code, so you
gotta do it yourself, right? - Gotcha. - Okay, so--
- So that's with the ENO? I dot INO is so I can hit, okay. - Yeah so now we're in a dot ENO file. Okay, so now what we're gonna do is I'm just gonna have you write out a blank sketch really quick all right. This is gonna be our test,
but you probably need Arduino. All right, here's Arduino man. - Awesome. Cool.
- Okay, so go ahead and hook that up, and then just real quick we'll go through writing a
sketch blank sketch okay? (light piano music) - You know it's times like these that I really like to
sit back and reflect, take inventory on my intentions
and my inner dialogue. What's going on in this sketch? What is blinking in LED really mean? And what did PIN 13 do to
be held above the rest? Did 12 do something so bad that it deserves to kinda be ostracized from the blinking LED community? These are the nagging questions, and on an emotional level
I just want to express that I don't even know if I like this guy. Why does he have so much to say? Why is his sweatshirt blue? I don't know, this is just a
lot harder than I expected, I hope it's almost over. - All right, so Josh, we've written out just simple blink sketch
here, which is cool. Now notice that like a bunch
of words are underlined, right? So there's something going on here, because it's not like the IDE isn't recognizing the
keywords and stuff like that, like pin mode and digital right and high and all that kinda thing. I think that's gonna get cured once we like verify and upload. But before we do that, you
gotta see down at the bottom? So at the bottom of
your screen in the blue we've got all these
different options here. So what you're gonna do is 'cause just like in the Arduino IDE where you have to select the board and the port and all that stuff, we're gonna do the same thing here. So you've gotten Arduino Uno, go ahead and select the board from up top. And there's all types of
different boards in here like ESP, 8266, ESP32, you know, there's a ton of
different boards in here. Same that you're gonna
find in your Arduino IDE. Okay, so you've got Arduino Uno selected. Go ahead and select the
cereal port it's on. There you go. It's that second one, Arduino. Okay, now select the
programmer down at the bottom. For an Arduino Uno it's
just gonna be AVRISP. Go ahead and select that. - And what is ISP real quick? - In system programmer. - Awesome.
- Of course I remembered that. Okay, sweet. All right so we've got the port selected, we've got the board selected, we've got the programmer selected. Sweet. So now what you're gonna
do in the you can close that little Arduino board configuration. No, you don't wanna do that. That's it right there, yep. Okay, so now there's a bunch
of buttons at the top there in the top right. One of 'em is upload and one is verify, let's go ahead and verify this first. Now so see that big list
of stuff right there? - Yeah.
- Go ahead and just type in smoke test, is this is
like searching for the file. Okay see now that's the one
that you wanna actually verify, so click that. Notice it opens up the Arduino ID. See this, it's opening up the Arduino IDE. Now go ahead and scroll back over and it should be saying verify and bam. Okay so see, now this that
black space at the bottom, that is the council, right? So go ahead and see the part where it says Sketch uses 924 bites? Yeah that, this is what you would normally see printed out to the council in your Arduino ID right?
- Yes okay. - So it's showing you the same stuff. Okay. Sweet man. That's pretty much it. Can you show us your Arduino board is the, oh actually we didn't
upload it though, right? Go ahead and upload it now. That's that button right there. Click upload. Again, it's using the
Arduino IDE functionality to actually upload it to the board, it's like interfacing with that. And then in the bottom see where it says Arduino IDE uploading in the very bottom on the blue there? Yep. - Oh. - Oh man. Oh no. AVR dude. Not. Yeah no. All right the infamous AVR dude error. Okay, this is like a get sync. All right, so lots of
troubleshooting we could do here Josh but this is a thing that
happens on the Arduino IDE, or it can happen in other IDE's, like here we are in VS code right? - Yep.
- Okay so what you're gonna do first troubleshooting step for this I think the easiest thing is
just reset your Arduino board. Just press the reset button. And then go ahead and click upload again and let's see what happens. - Oh. - Dude man, gotta clean
up some of that stuff. All right now notice in the
bottom it's Arduino uploading. All right usually when it takes this long it means we gotta, this isn't gonna do it. So can you go and scroll to
the bottom of your console? - Oh so it's like attempting. - Yeah. - And once it gets to 10 it'll say. No.
- Yeah, it just kinda gives up yep. Okay, so this ain't gonna work. All right so now what I want you to do is unplug your Arduino
board, just pop it out yep. And pop it back in. Okay, now notice that at the bottom it doesn't say Arduino uploading anymore. Like that's what you wanna do when you're doing these
troubleshooting steps, you wanna make sure that
it's done doing that before you try next troubleshooting step. - Okay.
- Okay so first thing we tried was just resetting the board, now we unplug the USB, plug it back in. Go ahead and click upload again. I think you actually hit
the verify button there, but that's okay. - Okay.
- Go ahead with, yep there we go, hit upload. Great, so now it uploaded. So go ahead and can we show us your board? Do we see LED on at pin 13? Sweet, okay man, that is it. Nice job man. Feeling pretty good about that? - Yep that wasn't too hard. - Okay, so here's what I'm thinking man. What I want you to do now is walk me through installing
VS code on my PC okay? (record scratching) - Okay, okay, okay. - All right because like you
just, you know what I mean? Like hey that's kinda learning like. - That's true.
- I showed you how to do it on a Mac, you've done it. Now I want you to walk me
through on doing it on a PC okay? - Awesome. I can just--
- Sweet. - I'll just recall it all and here we go. - Okay, let's do this. - All right Mike. Now we're the tides have turned, I will be showing you
how to download VS code. So let's open up--
- All right sweet. On a PC right? And you don't really use PC's so-- - I don't use PC's, so I'll just have to. - All right. - Walk my way through it. Let's go to whatever
browser you use on your PC. - I use Chrome. - Sweet. And I'll search for VS code. Awesome. Let's see if it identifies,
yeah download for Windows. So just click that.
- Okay, sweet. - That's nice that it identifies. Save it anywhere. - I will save it anywhere. - Got a lot of good stuff in there. - It's like a new computer so I think it's just like
bloatware crap you know? - Oh, really? - Yeah bloatware stuff. (Josh laughs) - Now what I like to do, Mike
is go down to the bottom left and just open it straight
from your browser. Just open that, double click it. - Is that what you want?
(Mike laughs) (Josh laughs) - And you can accept that. It's interesting I didn't
have to accept it on Mac. - Yeah, that is interesting. What's? - I don't know--
- Interesting. - I'm scared of this PC. - Yeah all right, let's see. It's gonna go to programs,
Microsoft, S code. Okay sweet. Yeah that looks good. - Okay. - Create disc, I think
all that looks good. This does say requires shall
restart, all right, whatever. - After--
- Man it sure asks me a whole lot more doesn't it? - Oh, yeah. Click install. I don't even feel like
had to do this install. Got the gnomes working here. - You didn't really walk me through that, I'm a little like what gives man? I thought you were gonna
show me how to do this. (Josh laughs) - Okay. I'm just scared of this interface. And then we'll hit finish, Mike. Launch visual studio code.
- All right great. - And it's opening up for us. - Sweet. - Wow looks like you've
been in here before. - I have been in here before yep. - Do you wanna do a smoke test or we? - Well we installed it, what
else will we need to do? - We're gonna add some extensions--
- If you wanna get it to work with Arduino, right? Okay sweet.
- We're gonna add some extensions. - Okay. - So it's up on the top
left, the yep there you go. Click that. Looks like we already got
some of these installed, but if we just just search Arduino. - Arduino. Okay. - All right verified for--
- All right I already do have it installed, you're right but. - Awesome. - Same deal. Just for clarification purposes, if you're just getting
started with Arduino, I would highly recommend
just using the Arduino IDE. Either Arduino IDE 2.0, that's like the new and
improved Arduino IDE, or the old the Legacy Arduino IDE. Maybe in another video we can talk about why you might want
to use VS code you know? Well hey Josh, thanks
for helping me set up VS code to work with
Arduino and my PC, man, I appreciate it. The next video that you should watch is the Arduino in 90 Minutes masterclass. It's gonna walk you
through programming Arduino from the bottom up. It's gonna give you a huge headstart. You can just, it's right here, yeah, you can just click it right there. (Josh laughs) It's right there. You don't have to do the
drag thing do you know that? - [Josh] No, I don't know how to do this-- - Okay okay so go ahead
and make it smaller again. I'm gonna show you like the
most amazing trick in the world. Okay, there you go. Now hold command option
and click the green button. (Josh gasps) - Whoa. - Yeah. (light music)