This is part one of what is likely going to be a three part series on programming in this one. We’Re going to talk about programming in general and what you learn in this episode will apply to just about every language it’s going to be high level overview. So if you are software engineer or something like that, you might want to skip ahead in the next episode. We’Ll talk about the specifics of our dueo programming in the environment, getting ready to program there and then in the third one we’ll actually write some Arduino code and make a tiny little project that works if you’re not familiar with the Arduino itself. I did a video on that recently. I’Ll put a link to that. You can go check that out and that may give you some better context for what all this is about. So let’s talk about programming in general programming is when you write some instructions and you give them to a machine. The machine then knows what to do based on input and situations that it’s in the input is often from a mouse or from a keyboard or from camera. Things like that that send input into a machine. The machine then has instructions, and it knows how to react. You’Re going to hear some words a lot when you talk about programming and so we’re going to go through some of those now the first one is syntax and syntax is the layout of the words and the symbols that are used to create the code by learning.
The syntax of a language, you learn the rules that you need to follow to make code that will run even spoken. Languages have a syntax it’s, how we put sentences together so that we can communicate another time you’re going to hear a lot is a variable. A variable is a container that holds a piece of information. There are different types of variables that are made specifically to hold different types of information and they’re, also just really general variables that can hold just about anything now. A good analogy here is a cup. You can have a cup that can hold water or iced tea or whatever, or you can have a very specific type. A coffee, mug that’s made to hold hot liquid. In the same way, a variable can hold a string like a word or it can hold a single digit number or a multi digit number, and there are some that can even hold a binary like a 0 or a 1 and that’s all they can contain there’s. Several reasons why you would use one type of variable over another and that’s really specific to the application that you’re working on another one you’re going to hear is a control structure and that’s a block of code that makes decisions based on variables or other conditions. One common example of control structure is an if statement. You’Ll see these really often and they’re basically laid out like this. If this can is true, then do this thing.
They can be much more complex and have totally different outcomes based on the different conditions, but basically it’s a way for the code to make decisions based on the current situation. The next useful thing to know is data structures, and this is how you store and organize your data. A couple of really common types of data storage that you’ll use in Arduino programming are lists and arrays an array is basically a list with some sort of an identifier that lets you get to each item in the list, usually it’s the index that they’re listed in So the first one in the list is 0. The second one is 1, the third one is 2 and so on and so on. So you can access any piece of information in the array. As long as you know its position in the list like I said, there are a lot of different types of data structures and each language that you learn will have different ones available. They’Ll also, probably implement them a little bit differently, but that goes back to syntax. Alright let’s move on to some more terms that you’re going to hear one will be compiling, and this is basically when you take the code that you and I, as humans can read, and you turn it into instructions that the computer can execute. There are specific applications called compilers and they literally take your code do stuff to it, wrap it up in a language that the computer can understand when you’re writing code.
There are often several chunks of it that you want to use over and over and over, between different projects or multiple times within the same project and there’s several ways to do that. One of those is called an include and it lets you write a whole bunch of code. Stick it in a file put it somewhere, and then you can include that file remotely into all the different projects that you’re working on includes are a great way to have a central piece of code that you can reuse in multiple projects, even between multiple developers. Another common way to reuse code is to write a function, and this is a reusable block of code that you can call from multiple places within your project. Functions kind of act like a box where there’s code that runs on the inside – and it only affects other things in that box, unless you tell it otherwise, the functions can take outside input and they can return some sort of output if you want them to so. For instance, if you had a function that was called multiply by 10, you could send in a number, and the response from that function would be that number multiplied by 10 within a single project. Functions are a great way to have a tiny block of code that you can call anytime as many times as you want so often, you’ll write a bunch of functions, put them in a single file and then use that file to be included across your projects.
A way to organize that’s past the include is called a library, and usually a library is just a loose collection of include files, functions, variables, data structures, any of the stuff that you want to reuse from project to project. Libraries can be really handy because they can act as boilerplate and infrastructure to put into a brand new project. It helps you to immediately have access to a bunch of work that you’ve done previously. That may be a little bit confusing let’s talk about. Why and when you would use a library, imagine you are writing a project and you wanted it to be able to post to Twitter, but you would go to Twitter and find an API or a library, and you would bring that into your project. That would give you the tools you needed in your project for your code to be able to post to Twitter all the while other developers are bringing those same libraries into their projects and getting the same tools and the same functionality. The last thing we’re going to talk about real quick, is initialization or init, and this is the set up of necessary elements that need to be in place before any code can run. This is where we would define or name data structures or variable so that we can give them values later on in the code, for example, if the code later is going to need to know how many buttons are involved, we want to tell it in the initialization There are three buttons alright for part one we’re going to stop right there and I know that’s not very concrete, it’s, a bunch of words that aren’t really attached to anything in your brain yet, but that’s all stuff that you’re going to need to know.
For next time, in the next episode, we’re going to set up the development environment, connect the Arduino and look at what the code actually looks like and then part three we’re going to write some code, send it to the Arduino and see what happens. So if you don’t want to miss those other parts to this video be sure to subscribe. I’Ve also got a lot of other maker 101 videos for you to check out, as well as a bunch of different types of projects, that’s it for this.
arduino language Video
arduino language news
Posted on Friday October 04, 2019BASIC Compiler & Programming on Arduino Zero Boards (Crowdfunding) CNX Software … Continue Reading »
Posted on Saturday October 12, 2019How To Make A Living With Embedded Systems Hackaday … Continue Reading »
Posted on Thursday September 26, 2019Review: OSEPP STEM Kit 1, A Beginner’s All-in-One Board Found In The Discount Aisle Hackaday … Continue Reading »
arduino language Social
🔬 Now that you’ve gotten your feet wet, dive into the kit and enjoy all nine experiments. Order yours today: http://bit.ly/2MnQ7fr