Arduino Uno R4 Wifi LESSON 1: Getting Started for Absolute Beginners

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello guys this is Paul mcarter with toptechboy dcom and we're here today with episode number one in our incredible new tutorial Series where you're going to learn to think like an engineer using the Arduino Uno R4 wifi now what I will need you to do is pour yourself a nice tall glass of ice cold coffee that would be straight up black coffee poured over ice no sugar no sweeteners none needed and as you're pouring your coffee as always I want to give a shout out to our friends over at sunfounder sunfounder is actually sponsoring this most excellent series of video lessons and in this class we will be using the sunfounder elite Explorer kit now most some of you guys might already have your gear but if you don't look down in the description there is a link over to Amazon you can hop on over there and pick your kid up and believe me your life and my life are going to be a whole lot easier in this class if we are working on identical Hardware but enough of this Shameless self-promotion let's jump in and talk about what I am going to teach you today I'm going to teach the absolute beginner how to boot up and write your first computer program on the Arduino R4 wifi now I should tell you what my assumptions are going into this class that this is lesson number one I'll tell you what my assumptions are I do not assume that you already have your PhD in computer science from MIT I don't assume you're already an expert and in fact I assume that you don't know anything about computers or technology but what I do assume is I assume that you'll pay attention and I assume that you'll work hard and the promise that I will make to you is if you will just pay attention and work hard I promise you that you will be successful in this class does that sound good I hope it does so let's just jump right in you can get your kit and what you need to do is you need to find your Arduino so open up that kit and you need to look for your Arduino mine came in The Big Box in this little box you'll need to open that box up and you will need to get out your new shiny Arduino Uno R4 y Wii so you're going to need that you're also going to need the cable the USB to USBC cable because you're going to in a minute need to plug this into your desktop but the first thing we're going to need to do is we're going to need to download the Arduino IDE or the integrated development environment and that is the little program that runs on your desktop computer where you write your Arduino program and then that IDE it compiles your program and then sends the compil code down into the Arduino so we need to get you set up with that Arduino IDE so I will get out of your way here and we need to come over you need to open up a browser I'm using the most excellent duck Dugo search engine just because I can and what you want to search on is something like Arduino ID download and then you come here and you can see that it says soft Arduino so we're going to click on that have a little bit of our copy and there it is downloads how easy is that now I am using for this class Arduino IDE 2.2.1 now I'm making the lesson today but you might be taking this class a year or two years from now I suggest that you use the identical IDE that I have because if you use the same IDE I have you will get the same results I'm getting and if you come someday in the future and download version 4 and then you write me saying your stuff doesn't work well it's because you're on a different IDE so let's stick can we to Arduino IDE 2.21 for this class and then I am on Windows and I like to download this this is just aexe so it's very easy to install so I'm going to click on this win 10 and newer 64-bit you also have Linux and also have uh Mac OS options now I had download this downloaded this earlier so that you wouldn't have to sit and watch me wait for the thing to download and you can see you get a pretty little a happy little Arduino icon like this and so we're going to click on that thing and hopefully something comes up and here it is so it is asking us to agree to this I have no idea what I'm agreeing to do you guys ever read this we might be agreeing to give our left kidney need to uino if in case they needed it or our firstborn child or whatever or you know do whatever with our data I don't know what it is but I'm going to live dangerously I'm going to say I agree I'm going to install it only for me not for everyone on the uh on the computers and I'll say next and this is just where it's going to put the program that's going to be fine and I'm going to click install and then we're going to have a little sip of our Go Juice okay all right man I've been uh I've been away from Arduino for a couple of years and this last week or two I've been working with it and oh man I love it I always love the arduinos I love the earlier R3 arduinos but man I'll tell you this uh this Arduino R4 is a bad boy I am telling you and we are going to have a lot of fun in this class I've got some great things planned out but what I'm going to do is I'm going to start you at step one you know very very simple today we're going to write our first program okay today we're going to write our first program but but before this class is over you are going to be doing some incredibly interesting things why because I'm going to teach you how to think like an engineer okay this is done so excuse me I'm going to tick run Arduino IDE so it'll go ahead and start it and I'll click finish and hopefully that thing will pop up for us here in just a second get this browser out of the way yeah it's coming up and I'm going to go ahead and try to make it nice and large so you can see easily what I am doing okay that looks pretty good okay taking a second and I think that uh that uh picked up the last program that I was working on so we don't want to do that so the first thing we've got to do now is we've got the IDE good that's good if you've gotten this far you've got what it takes to be successful in this class but what we're going to do now is we need to install the board so you come up here and do you see this little icon that looks like a board you're going to click that okay and then you're going to say Arduino Arduino R4 like that okay and then it comes up here similarly to what I said about the IDE the version of the software here I would advise that you use the same one I'm using which is going to be 1.0.5 now you can click and you can go to earlier versions but by the time you take this class you might have 2.7.3 but I recommend so this class goes smoothly for you and for me let's stay on the same version so we've got it here we're going to click install and we're going to install that board and you can see all types of happy little things happening down in the corner behind me it's saying processing Arduino board installing platform all these happy little things happening configuring configuring the platform I just got a uh I just got a uh let's let's see I just got a thing like do you really want to let it modify your computer yeah we'll we'll trust the Arduino guys okay so now we're are we've we've installed the board okay we've installed the board now what we want to do is we want to connect the board we want to connect the board to that USB cable that is connected to our desktop computer so I'm going to come over here and I'll put the board down and I'll let you see here we've got and one thing I like a lot of things about this uh Arduino R4 but one of the things I really like about it is this little plastic case because you see how you have uh solder joints on the back of the board and you just put this on your desk if you somehow put this on something metal it shorts out those things so you really don't want you want really want to be careful about the back of your boards hitting anything metal now we've got this little USBC cable that's plugged into my computer already this came in the kit too we're going to plug that in we heard that happy little noise that it has found the board and so that's good that's always a good sign man we're on a roll here lesson one and we're on a roll okay I need you to come back over here now and then what you're going to do is you're going to come to tools and then you're going to look at the board let's make sure you're on the right board it should already be there but you come board and you come to Arduino Uno R4 and we are on the Wi-Fi board so if you ever have something acting a little strange Pro tip make sure you have the right board selected because sometimes for whatever reason that can get a little goofed up so make sure you're on the right board and now we're going to come over and we've got to tell it what USB port we're on so we come down to port and you can see that mine says com for but if I look over here it finds the Arduino where it finds my Arduino at com 5 you see it says Arduino Uno R4 so I can see that com 5 would be the wise choice for you to make uh the wise choice for me to make for you it might not be Comm uh five it might be Comm 7even but wherever your Arduino shows up select that okay now I'm going to click this again to get this uh board installer out of the way and now this is where I would write the program we always start with a program called bare minimum so I want you to come down under examples under basic and I want you to open bare minimum and that opens in a new window so I'm going to go ahead and kill that first window I tried to figure out if there was a way that you could have it open just a tab like just open a tab in the old window but I couldn't figure it out so we just get a new window and we kill the first window okay so now what I want you to see with an Arduino program there's two parts to it as we get started there is the void setup and there is the void Loop and then we have what I call a clause the Clause starts with the open curly and it ends with the uh closed curly what do you do in void set up all the commands between the opening curly and the Clos curly that will be your Void setup so that's your clause and all of your commands would go in there in the void setup those are the commands that you want to execute one time so it's as you're setting up your Arduino you don't want to do it over and over the setup you do where in void setup it executes it how many times one time now the next part is the void Loop and whatever is in the void Loop it executes over and over and over so void setup the commands you want to do once void Loop the commands that you want to cycle through that you want to repeat over and over and over again okay so let's see maybe I can show you kind of the board here so we can be we can be looking at this board live live live as we start program okay so what I want to show you is if you look one of the things I really love about the Arduino is all of the pin are really labeled very quick uh very clearly so you see you have all these input output pin on both sides and they're all labeled okay and what I want you to notice is I want you to notice there is this one pen that is called pen 13 okay now these pens I can send data to them like I can talk to them or I can listen to them if I talk to them if I send data to the pen that pen is an output because I'm outputting to it if I'm listening or taking a reading I make the pin an input but what I want to show you is because we want to do our first cool thing in our very first program pin 13 this pin 13 is actually already hooked up pin 13 is already hooked up to this little LED here okay it's hooked up to this led here because I don't want to slow us down on our first lesson on our first uh computer program by building circuits or anything like that I just want you to write your first program in lesson one and the easiest way to do that is if we start interacting with this little LED here okay if we want to interact with that led the first thing that we are going to need to do is we're going to need to tell the Arduino are we going to make that pin pin 13 are we going to make it an input or are we going to make it an output and we do that with the First Command you're going to learn here it's called pin mode I type pin m o notice case is very important it's p i n uppercase M if you don't get the case perfect program's not going to work so we've got to work it uh perfectly also we only want to set the pin mode up one time so we do it where in the void setup and I do it after the open curly so it's in that Clause okay it's between those two curries it's one of the things we're going to do pin mode and then which pen are we going to tell it about pin 13 and then what do we want it to be an output and also notice all uppercase for that output so pin 13 is an output now something that's very important almost every command in Arduino at the end of the command we give it a semicolon and if you ever get an error one of the most common errors is you forgot a semicolon and the error message you get will be expected something disclaimer before the token it's like a really bizarre error message where really in fact you just forgot you just forgot your uh you forgot your uh uh uh SE your semicolon your your semicolon is that a colon no that's a colon right that's a colon you forgot your no that's a semicolon you forgot your semicolon okay now we're going to Loop here what do I want to do I want to turn that little LED on so what do I do I'm going to write to it how am I going to write I'm going to do a digital write case is important digital write where am I writing to 13 and what do I want to do with it I want to take it high you can take it high that will turn it on or you can take it what low and it'll turn it off okay so I do digital right pin 13 high that my friend should turn the LED on but uh what did I forget what did I forget get I almost clicked run and I almost forgot what our friend Mr semicolon okay now if you just click this check mark it will check your code and if you click the right arrow it will check the code compile it and download it into the Arduino so we're going to live dangerously and we're going to do that but let's save our program first so I'm going to do a ah you can't see see that I came on the other screen but do a file and then do a save as okay and then I am in documents Arduino okay and then what am I going to save it as I am going to save it as first program like that and then I'm going to say save and then it saves it so you know it's always good to get in the habit of saving your code all right the one other thing I'll show you is where does it save it well you saw it saved it in like uh whatever it was documents in Arduino you can change that if you come to file and then go over to preferences and then you can see that you can uh let's see where you see this sets where it saves your programs and I'm in documents Arduino you can set that to a different default so that every time you can save them wherever you want font size 24 uh scale 100% theme light language English this looks pretty uh this looks pretty good so I'm going to say okay but that's just in case you want to save that preference you can so now this is the moment of truth I will need everyone to hold their breath I will need everyone to hold their breath and then what are we hoping for we're hoping when we run that program that this little LED will turn on so I will need everyone to hold their breath and then I'm going to click this right arrow good good happy little messages ah happy little messages ah compiling sketch uploading okay it's compiling it's uploading Ultra breath and boom look at that the LED came on all right man we wrote our first program and it ran the first time okay now if I could turn that led off what else could I if I could turn that led on what else could I do comment down below what should we try let's try to turn it off and if High turns it on what do you think would turn it off I'm going to try a low okay we're going to run the program again we can always enjoy a little coffee while the thing is compiling and boom look at that led is off okay now what could we do if I could turn it on and I could turn it off I could make make that led what I could make the LED what blink okay so let's see if we can make it blink so I've turned it off but let me start by turning it on and remember this is in a loop so it's going to go on off on off on off if I put that in the loop so what am I'm I going to do I'm going to say digital right where am I going to write 13 what I'm going to do I'm going to turn it high so what will this command do it will turn the LED on what will this command do it will turn the LED off so what do we expect to see when we download this we expect to see it blink so let's go ahead and do this let's enjoy a little coffee as this thing is compiling it's uploading now and Houston we have a problem it's like it's not blinking although it's not as bright as it was while ago so I told it to turn it on off on off but all I see is kind of a dim LED somebody tell me what happened somebody tell me what happened one of you guys tell me what happened leave a comment or if you're in the uh Premiere if you're in the premiere then go ahead and uh uh leave a comment here why did this not work or why did we get an unexpected Ed result Okay the reason we got an unexpected result is do computers do things really slowly or do computers do things really quickly they do things really quickly and so what's probably Happening Here is this thing is turning on and off like a million times a second and your eye cannot perceive something that is blinking that fast so what do we really need we really need to slow it down we need to after we turn it on we need to wait a bit and then after we turn it off we need to wait a bit okay and there is a command and that command is called delay okay that command is called delay like that and I'll have to put a number in here okay and then delay I like to be mindful of my indents okay now I have to put a parameter in there I have to put a number in there and what it wants is the number of milliseconds that you want to delay so let me just again I don't want to leave anyone behind so let's just talk about what millisecs are okay there are 1,000 milliseconds is equal to one second so if you just went in there if you put a one on your delay it's not going to to delay for 1 second it's going to delay for 1 millisecond which is 1 1,000th of a second so how do you go from seconds I know how many seconds I want and I want to go to milliseconds what do you do well you just multiply by a th000 so let's say if I want to stay on 4.5 seconds that's half a second you know I want it to stay on for half a second how many milliseconds would that be well that would be 0.5 * 1,000 is equal to 500 so if I want it to Blink and stay on for half a second stay off for half a second what do I need to do I need to use 500 in that DeLay So let's come over here and let's come back to our program let's come back to our program let's come back to our program and then what we are going to do is on our delay I'm going to put 500 millisecs and then it turns on it stays on for 500 milliseconds it turns off it stays off for 500 milliseconds and somebody tell me what mistake I've made what do you not like about what I did I got so excited about milliseconds I had my little pad I was showing you everything what's the problem who are we missing our friend Mr semicolon on those two and if you don't do that then it's not going to work okay so we will do this again we really hope it's going to Blink this time so I will need you to hold your [Music] [Music] breath boom look at that boom blink thinking on for half a second off for half a second on for half a second off for half a second so that is really cool and it doesn't have to be the same either we could say well let's stay on let's stay on for 1 second 1 time a th000 would be 1,000 milliseconds and then let's stay off for 50 milliseconds so it's going to be on for 50 milliseconds it's going to be on off on off on it's going to be a blink like that so let's take a look and see what that does all right there it goes and look at that on you see how it's just barely off and it's on for most of the time so you see we've got a lot of control hey guys how cool is this first lesson you've written your first program you've written your first couple of programs and what commands have we learned today we've learned that if you're going to talk to a pen you have to do a pen mode you have to tell a you're either going to talk to it it's an output or you're going to listen to it it's an input so if I am going to turn something on like an LED or a motor or a Servo I would make the pin an output if I'm going to have a sensor and I'm going to read from the sensor a sensor hook to that pen and I'm going to read from it in that case what would it be that pin uh that pen would be an input okay so you've got to set your PIN modes we've learned that in void setup those are the things you're going to do one time and the things that you want to Loop you put in the void Loop so we learned pin mode we learned how to digital write High we learned how to digital write low and we learned how to put a delay into a program so I think that is pretty good I think we have made some pretty incredible progress for our first lesson and uh what I do need to do is this is a class and there will be homework and so what your homework assignment is going to be is play with your program and make the the delay for the high and the delay for the low make them the same okay make them the same value but I want to see how low you can make that number and still perceive it blinking so like at 50 milliseconds I can still see it blinking but as that number gets lower and lower and lower we're going to reach the point that the eye can't perceive that it blinks and so what your homework assignment is is to play with this and find the lowest number that you can put in these two places and still proceed a blink then you take a short video of you take a short video of your homework assignment you post it to YouTube in the comments down below you link over to your homework assignment and then I will check every single homework assignment then on your video that you po post you put a link back to this video so anybody who watches your video kind of know what you're talking about and where you came from and then I will look at your homework assignments and I will post comments about your about your assignments so guys I hope you're having as much fun taking these lessons as I am making them like I say I haven't used the Arduino in a couple of years and it is really great to be back in the saddle I'm having a lot of fun with it Arduino was the first single board computer that I learned to program and it still has a special place in my heart also I want to give a shout out to you guys who are helping me out over at patreon you guys are the guys standing with me keep me in the game so you patreon guys you're the guys that keep this great content coming thank you you can also help me by leaving a comment down below liking the video subscribe to the channel when you subscribe make sure you ring that Bell so that you get notified When Future lessons drop and most importantly share this video with other people because the world needs more people thinking like an engineer and fewer people sitting around watching silly cat videos Paul MC with toptechboy do.com I will talk to you guys [Music] later
Info
Channel: Paul McWhorter
Views: 29,936
Rating: undefined out of 5
Keywords: STEM, LiveStream, TopTechBoy
Id: S66Iwhk2V7A
Channel Id: undefined
Length: 28min 7sec (1687 seconds)
Published: Thu Jan 25 2024
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.