***Want to learn more? Check out our courses!***
https://bit.ly/3EMCjCy

***Get your Free Trial of Altium PCB design Software***
https://www.altium.com/yt/programmingelectronicsacademy

***Get the code, transcript, challenges, etc for this lesson on our website***
https://bit.ly/3ref0Nv

***We designed this circuit board for beginners!***
Kit-On-A-Shield: https://amzn.to/3lfWClU

SHOP OUR FAVORITE STUFF! (affiliate links)
—————————————————

We use Rev Captions for our subtitles
https://bit.ly/39trLeB

Arduino UNO R3:
Amazon: https://amzn.to/37eP4ra
Newegg: https://bit.ly/3fahas8

Budget Arduino Kits:
Amazon:https://amzn.to/3C0VqsH
Newegg:https://bit.ly/3j4tISX

Multimeter Options:
Amazon: https://amzn.to/3rRo3E0
Newegg: https://bit.ly/3rJoekA

Helping Hands:
Amazon: https://amzn.to/3C8IYXZ
Newegg: https://bit.ly/3fb03X1

Soldering Stations:
Amazon: https://amzn.to/2VawmP4
Newegg: https://bit.ly/3BZ6oio

AFFILIATES & REFERRALS
—————————————————
►Audible Plus Free trial: https://amzn.to/3j5IGrV
►Get LastPass: https://lastpass.wo8g.net/b3N1vk
►Join Honey- Save Money https://bit.ly/3xmj7rH
►Download Glasswire for Free:https://bit.ly/3iv1fql

FOLLOW US ELSEWHERE
—————————————————
Facebook: https://www.facebook.com/ProgrammingElectronicsAcademy/
Twitter: https://twitter.com/ProgElecAcademy
Website: https://www.programmingelectronics.com/
________________________________

I would say that arrays are one of the most useful programming tools available. Every programming language that I’m familiar with, at least, has some form of an array. If you’re trying to learn a new programming language, one of the things I would recommend is to get familiar with how to write and manipulate data in arrays. Like, if I was gonna learn a spoken language, like Russian, I’d want to prioritize learning the most common words and phrases first. Well, if I am learning a new programming language, I am gonna spend a ton of time learning how to use arrays in that language because they’re just so fundamental. In this video, you’re gonna learn how to go through, that is how to iterate through, an array in the Arduino programming language. If you can do it in the Arduino language, then you can also do it in the C and the C++ language. Knowing how to do this opens up a ton of useful possibilities for you as a programmer, and I’d argue, it’s really an essential thing to learn about any programming language that you’re interested in using. Stay tuned. Subscribe to our YouTube channel to get more videos like this. All right, before I jump in, I just wanna say a huge shout out to Altium for sponsoring this video. If you check out the description, you can get our link to a free trial of their software. All right, so here we are in the Arduino IDE, and I’m gonna write a little bit of code, and then we’re gonna talk about it. Basically, this is what I’m gonna do. I am gonna make an array and I’m gonna say, like, “you know what? This array is gonna be filled with sensor readings from some sensor,” like maybe, maybe my device is getting a packet of information from some other device, right? And I have no control over that other device. I’m just getting a series of inputs from some other device, and so I’m gonna make an array that kind of, like, mocks out that input, and then what I’m gonna do is I’m gonna iterate through each one of those inputs, and then we’ll print it out to the serial monitor. So let’s do that. All right, so what have I got here? Well, the first thing I did is I created an array, and this is just like a mock-up array. It could be whatever, but this is an array that holds floating point values. The name is called sensorReadings and the size is four. That means it can hold a total of four values. It can never hold more than four. Like, the limit, the size, of this array is established when you first create it. So the size is four, and then I initialize it with four separate values. Now, you don’t have to put in the values when you initialize it but in this case, I have. So I’ve got four floating point numbers that I initialized it with. Now, for this discussion, what’s important for us is we understand, like, what the index of these numbers are. So let me just write that out above this, so we can get clearer. So the index value refers to the position of the element in the array. Now, if you’re wondering like, “hey, what is this index thing?

CONTINUED…
https://bit.ly/3ref0Nv

***About Us:***
This Arduino lesson was created by Programming Electronics Academy. We are an online education company who seeks to help people learn about electronics and programming through the ubiquitous Arduino development board.

***We have no affiliation whatsoever with Arduino LLC, other than we think they are cool.***

source

6 thoughts on “Using Arrays with For Loops”

Leave a Reply

Your email address will not be published. Required fields are marked *