![]() Int floats in strings over the serial port and so let’s. So what I want to do in in just a little review, how to read. Well, the person’s name would logically be a string, and so you’ve got to kind of scope things out with what your variables are when you start when you start a project. Okay, if you think about a program where you’re going to input a person’s grades and average them, you might want the person’s name as a starting point. So you see you need to look through here and kind of decide on your project, what your variable names are going to be in whether they should be against so votes or strings. Maybe someone made a 97 and a half so in that case the variables the grade itself should probably be a float. The grades themselves you might have in between grades. I have 5 grades or I have 14 grades, so it would make sense to make that number and but now I’m inputting the grades. ![]() If you said, I made a program to average grades and you said how many grades do you want to input? Well, the number of grades that you would have would always be round numbers. So, for instance, if I’m going to declare a pin and I’m going to be using, pin 9 there’s, no reason to make pin 9, you know a pin number to be a float because your pins are always going to be round numbers and so it’s just natural To declare your variables that you’re going to use associated with pins it’s just natural to declare those ends, let’s think of other things. You can make your programs more efficient if you only use floats when you really need them and use its when you can get out when you can get by with it. All right that you know a float could probably do just about anything that an int could, but it is good to use ents when you can get by with them integers, because they take so much less memory than a float. Okay, now it’s true, that you could probably just make everything either a float or a string. You need to kind of figure out the bucket in the label that you’re going to put on the bucket the name of the variable, and then you need to figure out whether that variable should be an int, a float or a string. Remember a variable it’s, like a bucket in the name of the variable, is the label on the bucket. ![]() You need to identify all the variables that you’re going to be using and not just kind of like the variable name. ![]() So, if you’re going to have a project, one of the first thing that you’ve got to do is you’ve got to kind of identify all of those variables that you’re going to need. But if you learn those three data types and how to get them across the serial port you’ll be able to do just about everything. You would call them real numbers, it’s, all those in between numbers that are between the integers, and the third thing you need is a string and basically a string is a string of text, and so, if you can have a variable, that’s, a string for a string Of text, an int for your round, integer numbers and a float for the in between numbers, you can do almost everything now it’s, true, that if you get more sophisticated, you maybe could do things a little more efficiently or you can do things more elegantly. We call them floating point numbers in math class. Okay, there are other data types out there, but I want to kind of have the minimum set that will meet almost all of the requirements that I’m going to run into the three data types that will get you through.Īlmost all of your projects are int for integer float for floating point number and remember in the world of programming. I can do if I use one or all of these three data types. You can do the project with base by utilizing basically three different data types, there’s a lot more data types than the three, but almost anything that I want to do on the Arduino. ![]() Okay, I just want to show you the easy way that will simply work and you’re welcome to go in and learn the more complicated or the more in depth ways, but I just want something that will work: okay for almost every project that you’re going to do. But what I want to do is I want to show you the easy way. It is that most of the tutorials that I see on the web make this unduly complicated there’s a lot of very tedious ways of doing it there’s a lot of very difficult ways of doing it. It’S it’s, something that you really need to do for all types of different projects and also the reason I want to go over. On the Arduino – and this is something that we really went over a little bit in Lesson – number six but it’s such an important topic and something that we’re going to really be need to be able to do for the remainder of the lessons. ![]()
0 Comments
Leave a Reply. |