is arduino programming easy
I think programming, programming and microcontroller is something that’s intimidating to a lot of people, but I will promise you by the end of this first tutorial. You will have written your first program. You will have downloaded it into the Arduino and it will have done something interesting. I think that the Arduino is simple enough, that a seventh or eighth grader could do it if you’re a little smarter, a little more advanced, technologically, maybe a third or fourth grader can do it so I’m going to take you through it step by step. This first lesson: we’re gon na make a light, blink and then we’re going to go all the way to showing you how to build and in this instrument package based on the Arduino that you can send into space. This is a picture that was taken by an Arduino based system that we developed and sent to one hundred twenty thousand feet so we’re, going to start by blinking an LED and we’re gon na go all the way to being able to build a space probe. Not all in lesson 1 lesson: one will be blinking the LED, but what I want to do is I want you to know, is I’m going to take you through this step by step I’m, not going to assume that you have a degree in computer science, I’m Going to take you through it step by step, it’s not going to be anything harder than you know, installing a printer or something like that.
So first of all, we need a microcontroller. The microcontroller we’re going to be working with is the Arduino. The reason I chose the Arduino is there is such an incredible amount of infrastructure out there, almost anything that you want to do with the Arduino. Someone else has already done: there’s, incredible resources, incredible infrastructure and you can get the Arduino for about 20 bucks and so it’s. A very affordable platform to work on I’ve got some resources listed on my website, top tech boy comm. If you visit there, I can help get you hooked up with one or I think you can find one in a number of different places. The thing about this is, is you can get the bare Arduino for about 25. 20. 25 bucks. I show you down here. One that’s a set up and ready to go, but what I’m really going to suggest is if you’re gon na go through this, I would suggest that you go ahead and buy the spark fun invent, get the thing about the sparklin inventor kit. It has all the wires and connectors it has all types of components to take you through about ten or fifteen different projects. The Arduino inventor, the sparklin inventor kit, comes with a number of different sensors, a number of different actuators, and a lot of these subsequent lessons are going to be based on components in the smartphone inventor kit. The Sparkfun inventor kit is about a hundred bucks to me.
It represents a really great value. You could probably go out and try to buy all the different parts yourself, just starting with a bare Arduino, but I think in the end that you’re, probably gon na be better off. If you go ahead and get the gift of spark fun and dinners kit spark fun, is a great company had great luck with them and highly recommend their products? Okay, but today, we’re, just starting with the bare Arduino and we’re gon na see how you would go about working with it first thing: is you got to just take a couple of minutes to install some software really. This is no harder than if you did something like install a printer, the the best place to go to do this is you can go to this website, which is called the arduino website, and it is at arduino, dot c c en slash guide, slash windows; okay, If you go there, it has a quick overview of how to download the software. The first thing you do is you download the in the arduino environment, that is, your integrated development environment that’s, the palette on which you will create your your your platforms, you just click on the download page and i’m on windows. So i downloaded the windows software. Then you click on it and it installs it very, very simple and then basically, what you got to do is plug the board in there’s a USB cable over here you just plug it in with a standard, USB cable, nothing difficult there and the final thing is You have to show the arduino where the drivers are.
You can go through this, but it’s. Basically very simple: you go to the device manager, you right. Mouse click on that serial port and then you point to where the where the software is for the drivers. This takes you through it in a little bit more detail. I think that you could probably do this in about five or ten minutes so i’m, not going to bore you by taking you through step by step that step by step with that, but once that is installed, then what you do is you launch your Arduino environment And it comes up looking like this. The first thing that you’re going to see is every RT Arduino program has two parts: it has a void setup where you set the arduino up, and then it has a void loop. The things that you want to do, one time like setting up your pins. You will do in your void setup and the things that you want to do over and over and over. You do in your void, loop and so basically, two parts of the program, the void setup in the void loop. But before you actually get going there’s two things that you need to set in your environment. The first thing is: you have to tell your integrated development environment, which Arduino board that you have chances. Are you have the Arduino Uno? Okay, I have the uno rev. Three, almost all arduino is out. There are the arduino uno.
You tell it that that’s what you have by going to tools and board – and you can see here that mine is already set on arduino uno, but you want to go ahead and do this to do that, because if, for some reason that is not set right, You will have problems. The second thing you have to do is you have to tell the environment which port which serial port your board is connected to, and to do that, you come down to tools port, and you can see that mines on comm 11. You want to go ahead and check, though, because sometimes you have more than one option here and you’ve got to tell it with tell it which one it’s on and if you see like it, pop up com4 and comm seven. How do you know whether your board is on comm, four or comm? Seven and I’ll show you you come over here and you get the Arduino okay, you see mine’s already on the serial port and you unplug it when you unplug it. You hear that all the sudden, the USB is not happy because it you heard that dingdong, because you’ve unplugged, something from the USB that it doesn’t like. If I come back now, you see that that point that comm 11, that port 11 is no longer there. It is disappeared because comm 11 disappeared. That tells me that in fact my Arduino on Comm 11 news so let’s come back to this back and now we are going to be pretty sure, get that nice and neat there we’re gon na be pretty sure when we come back to port comm 11 is Back so that tells us yes, in fact, our Arduino is on comm port 11.
Now the reason I go through all that is a lot of times when you plug it in there’s, more than one choice and that’s how you can absolutely positively make sure that you’ve got it set on the right choice. Okay, now let’s see if we can make this do something, and so basically, if we, if we look down here at the Arduino, we can see that there’s all types of different pins. On this side, there are basically 13 different pins, starting at pin 0 all the way up to pin 13 after pin 13 there’s a ground, and so, if you want to use an external circuit, if you want to do something, you can connect to the Arduino ground Through that one, but right now, we’re gon na be talking about 10 0 through 13. If you have an external breadboard which will turn it talked about in the next Arduino tutorial, you can bring those pins out and you can start turning LEDs on and off. But today we want to make it where you brought your first program and we want it to be as simple as possible and so to make it as simple as possible. There’S a little thing here, and that is, let me see if I can focus this. A little better there’s a little thing here, and that is that on 10 13 there is an LED on the board already hooked up. This little LED is hooked up to pin 13, and so if we do something to pin 13 that connects to that LED and so let’s see if we can turn that LED on as our first program.
Ok, our very first program. Well, if you’re gon na talk to pin 13, you have to tell the LT Arduino what pin 13 is, and you do that as a pin mode. You set your pin modes of all pins, you’re gon na use. You have to set your pin modes, you set them one time, so you do it inside the void setup. One of the things about this programming language is that the clauses begin with an open, curly bracket and they end with a close curly bracket. So we say: void setup, okay, that’s gon na be kind of like my claws, that’s gon na be kind of like my paragraph. It begins with the open, curly braket and it ends with the closed curly bracket. Everything you do in Arduino anytime. You have any type of Clause, it will begin with an open, curly bracket and it will end with the close curly bracket. Everything that you do between those two curly brackets will be that Clause of the set up. Well, what do we want to do? We want to do our pin modes. How many pins are we working with this time? Only one we’re only working with one, because we’re only working with ten thirteen, so we have to set our pin modes so we have to go, pin mode. You have to do it exactly like I’m, showing you here notice that it’s P. I am, and then capital M OD e that’s actually called bumpy text and it’s used a lot in programming, and that is you.
Don’T want to put spaces between words, but the way you sort of show one word from another. Is you make capital the first letter of the next words you can see? This is the word pen mode and it has to be capitalized like this. That is case sensetive. Now you open up your parentheses, and you put your arguments inside of these parentheses and the arguments that you want is you’re going to set up in mode. You have to tell it which pen are you setting up I’m setting up 13 and it can be either an input or an output if you’re going to be reading from pin 13 it’s an input, if you’re going to be writing to pin 13 sending an output To it it’s an output, we are writing to it, so we’re gon na say that it’s, an output also notice that output is case sensitive. It is all in capital notice to pay attention to the colors that, because pin mode turned orange because the Arduino recognized that that was a command it’s like hey, I recognize, pin mode. I know what you’re talking about so when I see this pin mode turn orange. It kind of gives me a warm fuzzy feeling that the Arduino or environment recognizes what I just said. Also when I typed in output, it kind of turned blue that’s telling me that that Arduino recognize that word, and so what we have here is. We have now told the Arduino that 10 number 13 is going to be an output we’re, going to be sending information to it.
So now that we’ve done that we can come down here in our void loop and we can do our first command and what we are going to do is we are going to do a digital write, and so what we are going to do is we’re gon Na turn, thirteen pin 13 on or send pin 13 high or basically what you’re doing, is you’re sending a seven volt signal to pin 13. When I send a I’m sorry I’m sending a five volt signal to pin 13. When I send a five volt signal to pin 13 – and that should turn this little LED on so what we’re gon na do is we’re gon na do additional right. We got to tell it which pin are we writing to? We are writing to pin 13 and what are we doing? Are we sending it high? Are we sending it low? We are sending it high, okay and then all lines just about in the arduino end with a semicolon. So when I did my pin mode, I ended with a semicolon when I do my digital right: 10. 13. High. We end in a semicolon now, just because I write it on this screen does not mean that it automatically goes down into the Arduino to get it into the Arduino it’s got to be compiled, and then the code has to be downloaded, and we can do that With the click of one button, this is this button.
What this button does is it compiles the code and it sends it on down to the Arduino. So if I click this and I’ve done everything right, I usually hold my breath because I make lots of mistakes. You see that it’s, compiling everything’s green. That means it’s happy and it has gone down in there and look what happened. We sent that pin 13 high and that turn that LED on. If we brought a wire off of this pin 13 and externally hooked it to an LED that would turn the LED on well that’s kind of exciting. If I can turn this LED on that’s on board, I could bring a wire out and I could jump jumper. It over to something else, and I could turn an external LED on and the cool thing is, is that if I can turn an LED on, I could turn a motor on it. If I could turn a motor on, I could open a door open a window, and so, even though this is a very, very simple command – it’s, very, very powerful, because now programmatically, I just sent a voltage to a pin. I turned an LED on. It could be a motor or it could be a servo or it could be any number of different things, but we’ve written our first program and we downloaded it. So I hope you follow along with me, and I hope that you’ve been able to write your first program now.
I’M gon na do one more thing in this video because I think that it’s it’s, you know we’ve made some good. We made some good progress and I just want to show you one more little thing, and that is: is that really it’s a good programming practice not to come down here in the program and say sin? You know, make pin 13 an output and then write, pin 13 really late let’s play around with this a little more before I do before I introduce that. Let me let me just go ahead and say: what do you think that we could turn that LED off? What do you think I would want to set this to if I wanted to turn the LED off, I turned it to high and it went on what would you do if you wanted to turn it off? Well, how about we make it low that’s? Probably what you would have guessed, but wait a minute. The LED didn’t go off. Why did the LED did not go off because I have not sent this code down into the Arduino yet remember we got to compile it and send it down there. So I click this it’s compiling it’s, sending it down and it turned that off. Okay, it turned it off let’s see if we can turn it back on we’re gon na go high again, make it high and you have to spill it right. Okay and watch this over here.
If we’re watching, ok, the LED comes back on so you see, we can turn it on. We can turn it off from our program now. One of the things I want to introduce here in this first lesson is it’s, really a very poor programming practice to come in and say turn pin make tenth the pin mode of 13, an output in then digital right 13, because your program gets more and more And more complicated you get more and more and more stuff hooked up it’s harder to keep track up. So what you want to do is you want to set variables, and so we’re gon na set a global variable, which means we’re going to do it up here at the top before we do anything else, and what we’re going to do is we’re going to declare A variable, and the type of variable that you can have is an int which would be an integer, a float which would be like a real number or a string which would be like words like groups of characters. Well, you always remember having to learn in math class about integers and reels, and – and this is where you’re actually going to use it, and so you think, if we’re going to use a variable that’s going to declare a pin in the the numbers could be 0. 1. 2. 3 up through 13, because our pins go 0 to 13. What type of variable would you need you wouldn’t? Need it to be a real number.
You wouldn’t need it to be a floating point number or a float. You would just need it to be an integer, because pins are always pin 1 pin to pin 3 or up to pin 13. You would never have a pin two and a half, so what we need to do is we need to declare our variable and we’re going to say our variable is an int int and look at that. It turns orange. It recognizes that word and said: hey man, I know what an int so that’s good. It recognizes what we’re trying to do, and now we got to give that variable a name. Okay, you can name it anything you want. You can name it anything that you want. I’M, going to name mine LED, pin, okay, you could have called it a gazebo if you want to but what’s important. Is you want to name your variables so that when you come back and look at your code later, it sort of makes sense what you were trying to do so led pin that tells me that I’m going to set a pin to something? And now I can go ahead and tell it which it is. What number do I want to put in LED pin well we’re working with pin 13. So now I have a variable. A variable is like a bucket. The bucket is labeled LED pen. Now, I’ve put a value in that bucket. The value that I put in that bucket is 13 so down here now I don’t have to type in 13.
I can put the variable name and I put in LED, pin – and I come down here instead of saying 13 I say LED okay and the good thing about this is now. If I ever want to change it, I just change it in one place and it changes throughout the program and if you go in and keep putting 13 3 18 13 13 13 down here, 50 different times in your program. Every time you use it, then if you want to go to pin 12 for some reason you want to change to 10 12. You got to change it everywhere and I guarantee you’re gon na miss one and you’re gon na have a problem that takes you a few days to figure out where it is so. Therefore, we declare variables, we declare our variables up at the top and then we use variables instead of using constants in the program. So here we’ve declared the variable led, pin it’s an integer and we put a value of 13 into it, then anywhere that we want to use this number. We use the variable, so pinmode is now LED. Pen and digital right is now LED, pin what’s LED, pin it’s an integer with of that variable with a value 13 that we set up here. So let’s click on this, and you can see that it’s still happy it downloads and then the light comes on. So everything is working well, we’ve, seen that we can turn the light on, we can turn the light off.
What if we try to blink the light well to blink the light, we would want to turn it on digital right, LED pen high, and then we would want to do another command. Digital write, LED pen again and this time set it what low okay. So this will turn that and off so now it’s going to go on it’s going to go off and we should see it blink, so let’s download the code and then let’s look over here. It downloads and wait a minute. It doesn’t look like it’s blinking, it’s sort of isn’t it’s kind of like the brightness, went down it’s kind of on constantly, but it is just very dim. So what happens there? Well, what happened is is that the Arduino can execute thousands and thousands of code of lines of code a second and so that’s. Turning that LED on and off so quickly that you, I can’t, even perceive it what your eye perceives as a dim LED like it’s on half the time and it’s off half the time and so it’s going so fast that you can’t even see it so let’s. Come in and let’s put a delay in here to slow it down. Let’S say we want to do a delay that’s, another command, that we can do in the delay parameter or the argument that goes on delay is in milliseconds, so there are a thousand milliseconds in a second. So if we want it to stay on for a second, that would be how many milliseconds that would be 1000 milliseconds, okay and then, if we come over here we can say we want it to be off for a thousand milliseconds.
So let’s look at our code. We tell it turn the LED on wait. A second turn the LED off wait a second and then because this is in a loop it’s, going to keep going back and forth over and over and over. This void. Loop is going to execute over and over and over so we say: digital right LED, pin high. That turns it on delay a thousand milliseconds that’s 1 milliseconds, so turn it on wait. A second turn: it off wait. A second and let’s see what happens here. Okay, now, if we look, you can see it’s on off on off on off it’s blinking, exactly the way that we told it to okay. Now, what did I do? That was not real good. Here again, I started using constants. I shouldn’t use a constant down there. Okay, because now, if I want to change it I’m, going to change it everywhere, let’s create a new variable. This can be an integer too, and why don’t we call this wait time and why don’t we set it to a thousand okay. Now, when we come down here instead of bring a number in put our variable in in wait, I’m. Okay, then we come here. Wait. Do it exactly right, that’s case sensitive, wait time again, I could have called this variable anything. I wanted that’s just the label that I’m putting on the bucket a variable is like a bucket and the label that I put on.
It is the name of the variable. The label I put on this variable is wait time. The value that I put in the bucket is a thousand. So if I come down here, look at that now, if I want it, let’s look everybody’s, happy, it’s, tan, green and everybody’s happy and now, if I look down here it’s on for a second off on off on off on just like, I told it to do Up here, but now the cool thing is, is that if I want to change the amount of time it’s on let’s say we want it on for a quarter. Second off for a quarter. Second that’d be what’s, the fourth of a thousand milliseconds. That would be two hundred and fifty. So if I change that to two hundred and fifty, this shouldn’t clink faster, okay, let’s download it and look at that on off on off on off, you see how it’s run a lot faster now on off on off on off on off. If what if I want it to just blink and then stay off for a long time and blink and stay off for a long time, well, there I wouldn’t want like two variables. I wouldn’t want to wait time on and I would want a second variable. Integer wait time off, and then this would be. Let’S say that we wanted on for just a tenth of a second, so let’s go 100 milliseconds, and then we want it off for 900 milliseconds, and so what this is going to be it’s going to be on.
For a tenth of a second off for nine tenths of a second and then it’s inside this void loop, so it’s going to keep looping so let’s come down here and look at this! Oh, Oh remember: I’ve got to change it down here, so this would be on delay, wait I’m on and then here it would be delay wait time off. Somebody should have warned me about that when I made that mistake. Okay, so let’s look here downloading it it’s happy and then look you see it’s on for a tenth and then it’s off most of the time, it’s on for a tenth and it’s off for most of the time. What if we wanted it on most of the time and off the other way? Okay, we could come up here to make this 900 and then we can make this 100 okay and then let’s download this okay, if you see it’s run most of the time and it’s off on was the time it’s off okay. So this is showing you what we have. We learned in this first in this first lesson, you’ve written your first program, you’ve learned how to declare variables. You learn that it’s a lot better to use variables than it is to just plug numbers down in here, because then we can just do our changes up here and it makes it work a lot better and you’ve written your first program and you’ve made this. Like do things, what I want you to do is I want you to play with this, that you could come in and do more than just these rights.
You could turn it on and off fast and then on and off slow just sit and do some creative things where you make this light. Do what you want it to do and that’s your assignment for tomorrow, then the next thing that we’re gon na do in the next lesson is in lesson number two we’re gon na go in and start actually building a circuit building, a circuit separately, where that circuit Is going to be controlled by this? What I will promise you is, if you will stick with these lessons, I will take you through things, step by step by step. You’Ve written your first program in tomorrow’s lesson: lesson number two: you will build your first circuit that will be controlled by this and little by little will build until you get all the way to the point that you can start building your own instrumentation to send this Space, okay, I will take you through. We will start by blinking an LED which we will do today, which we did today and you will go all the way to be able to go to space like we did here in send pictures back so again. My name is Palma Corner. I am from top tech, boy, comm and hope you will Cannell and continue to tune into these.
is arduino programming easy Video
is arduino programming easy news
Posted on Friday October 18, 2019Python programming language: A cheat sheet TechRepublic … Continue Reading »
Posted on Thursday October 03, 201910 Years of Programming Language Evolution EE Times … Continue Reading »
Posted on Saturday October 26, 2019Latest robot of Boulder’s Sphero to aid all levels of programmers Boulder Daily Camera … Continue Reading »
is arduino programming easy Social
alright buddy im putting down some ground rules i need to make vids about these and im afraid ur gonna steal views so could u stop pretty please?
He is really good at teaching.
Thank you so much.
God bless you!
FINALLY!!!…….something I understand.
GREAT lecture! 🙂 better than all the other complex introductory videos out there which assume we know electrical engineering.
hats off to this guy!!!
Thank u so much u just made me love programming more
I love you
You ever heard of sickoMode ?
Me ha gustado mucho el video es mejor de los que he mirado, pero con usted es mas entendible para mi.
De echo no hablo mucho ingles y aun asi le entiendo muy bien.
Super Sir. Thank You
Dude you do amazing work man, so much appreciated, can’t express my gratitude enough
Thanks . . . I remade all these videos so you might think about moving to the new playlist . . . much better production quality and updated content
Thanks… This is easy for me, i am studying computer science at present (Peripherals, App development – Dissertation level)
Please can you advise on building an app on a device that can control an Arduino board?!
Thanks (Y) Phill
NA PARW 3DPRINTER I OXI OMWS?
Like this if you are still here in October 2019 because of the exam hahahahaha
this is the best tutorial for Arduino
I will recommend to my friends
Check out my new arduino playlist . . . much better tutorial series. Same channel, just my updated arduino tutorials
10/10 lov it
Literally, the best instruction I’ve received regarding ANY programming. You are a shining example of the difference it can make when an instructor not only knows a topic well, but also knows how to TEACH it well.
This is one of better people to learn from.It is really easy and he explains everything short but you can understand it.Thanks McWhorter!!
I really like your instructions sir