Using Arrays with Arduino

  Рет қаралды 30,219

Programming Electronics Academy

Programming Electronics Academy

Күн бұрын

Пікірлер: 41
@frazier283
@frazier283 2 жыл бұрын
Great info. You are absolutely right to be concerned about inserting element values outside the size of your array. I learned first-hand you should always always always specify the size of your array when initializing. I spent several hours re-reading a multi-array code before I finally found the typo that bricked two Nanos by changing a value Beyond its array size. Fortunately I was able to salvage them by reloading their bootloader. However if I had specified the size of the array, the typo would have been caught when compiling and would have saved me hours of trouble.
@mariaviklund4546
@mariaviklund4546 4 ай бұрын
I was banging my head trying to get this to work on a project before i found this video. Now i know what i did wrong. Mixed the data types! Thanks so much!
@programmingelectronics
@programmingelectronics 4 ай бұрын
So glad it helped!!!
@ChadKapper
@ChadKapper 2 жыл бұрын
This a super-valuable lesson! Thank you!
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Thanks Chad!
@KW-ei3pi
@KW-ei3pi 5 ай бұрын
Love your channel. It's probably the best source of videos for Arduino instruction. I've been watching your videos for about a year. I was wondering where you are from, as you have different way of pronouncing the word "put". It was very noticeable in this video. Thanks. Regards
@programmingelectronics
@programmingelectronics 5 ай бұрын
Thanks! I'm from the midwest, but I just say "put" wrong 😀 I have no idea how I lived over 4 decades saying it incorrectly, but I am working on it! I don't even play golf.
@pboston6RR
@pboston6RR 2 ай бұрын
WELL DONE! Now I’m ready to use arrays. Thanks!
@programmingelectronics
@programmingelectronics 2 ай бұрын
Great!
@tohcp5729
@tohcp5729 Жыл бұрын
it is great thing to learn and ready "open my eyes " and how the person created the so interesting guiding in Arduino programming way ...keep up
@programmingelectronics
@programmingelectronics Жыл бұрын
Awesome! Thank you!
@leythecg
@leythecg 2 жыл бұрын
Very well explained! Thanks very much!
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Thanks so much!!
@jlr3636
@jlr3636 Жыл бұрын
Your explanation of what you are going is very clear, however an example of why or where to use an array escapes me. An example would help. Your videos on Arduino are among the best, thanks.
@felixcosty
@felixcosty 2 жыл бұрын
Thanks for the video. Could you please do a video on the joystick library. Trying to convert an old analog joystick to digital using a pro micro. Could you show how to program the Hat, and triggers/switches so that the triggers and switches work like joystick switchers. Right now my switches work as keyboard commands trigger = A and so on. I have seen short programs that make the switches act as joystick commands, would like to see the longer version where each switch is its own bit of code. Hope this makes sense.
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Glad you liked the vid! Thanks for the recommendation on the joy stick library!
@tharchit9028
@tharchit9028 9 ай бұрын
THANKS MY DEAR !
@programmingelectronics
@programmingelectronics 9 ай бұрын
Thanks for watching!
@peterlyne9378
@peterlyne9378 Жыл бұрын
Thank you so much, very well explained
@jaysonbutcher1178
@jaysonbutcher1178 2 жыл бұрын
Thank you! You explain it well. ;)
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Thanks so much for the note!!
@learn3715
@learn3715 2 жыл бұрын
Great upload video! 👍 stay connected! 😍Like 👍👍👍
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Thanks so much!
@jean-francoismaury5822
@jean-francoismaury5822 6 ай бұрын
Really video, thanhs !
@midianalbertokhaiyow8195
@midianalbertokhaiyow8195 2 жыл бұрын
excellent video, I have a question, let's imagine I have many arrays, let's say those have names like red blue green, and each array has several elements that in some cases can be as few as 7 or 10, and in other cases they are as large as 300 elements, In the main function, what it does is take an array as for example the "green" one and execute anything with the elements, such as adding the elements to each other or subtracting them, that is not really the important thing, the important thing is that I want to learn is how to change the array that is being used in the function through serial communication, for example, command by serial communication "red" and in the main function it is executed but in this case instead of using the "green" array use the "red" and if I write "blue" then change the "red" for "blue" ...
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Great question! I’ll see if we can come up with a video to help on this. You might consider using a switch case statement to select the appropriate array based on the serial input.
@midianalbertokhaiyow8195
@midianalbertokhaiyow8195 2 жыл бұрын
@@programmingelectronics Hello, thanks for your answer, I did not consider using a switch case, because there are too many arrays, neither consider using an array of arrays, because of the big difference between the content of arrays, since some contain few elements (4 or 10) and others contain many elements (300 or 400). I suppose that I could use pointer methods, what I am not clear about is how to convert a string sent by serial as "red" to a pointer, and then be able to use the pointer to fill it with the content of the "red" array and execute the code
@bassman2162
@bassman2162 2 жыл бұрын
@@midianalbertokhaiyow8195 put the array names in a switch case that calls different functions depending on the color (array name). Then write a function to handle that array. If some of the functions do similar things, pass arguments to the function to determine how it process the passed array.
@programmingelectronics
@programmingelectronics 2 жыл бұрын
@@midianalbertokhaiyow8195 I was thinking what @Bass Man mentioned below, but I may not fully understand what you're after. Sounds like a cool application though! We do have several lessons on using serial input on KZbin that may be helpful on this potentially. Best of luck!
@joshuapitong899
@joshuapitong899 2 жыл бұрын
Really helpful.🙌
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Glad it was helpful!
@voytechj
@voytechj 2 жыл бұрын
@7:10 other elements will be initialized with default value, and for a type of byte it will be zero.
@platine141
@platine141 2 жыл бұрын
Is it possible to just pick up elements from 0 to 4 for example like in python? And why my array shows double the size of its elements? I didn't set the size of it
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Great questions! 1) I believe you you are referring to "slicing" an array? Like you would with a list in python? myArray[] = { 10, 20, 30, 40, 50 } where... myArray[0:2] would give you the elements 10, 20 ->To my knowledge you cannot slice arrays like this with Arduino. 2) How are you finding the size of your array? Are you using the sizeof operator? If you use sizeof() it will return the number of total bytes in your array, not the total number of elements it can store. If you want to get the size of your array, you need to divide the sizeof(myArray) / sizeof(myArray[0] -> this will give you the actually size of the array.
@senpuuxd1032
@senpuuxd1032 Жыл бұрын
How to remove something from array? I want remove uid tag from 2 dimensional array after he was scaned and compare to array i don't know how to so this and can't find simple (to me) way
@Dartheomus
@Dartheomus Жыл бұрын
It is killing me not to know where 155 came from. It's not an arbitrary value... it must have derived it from something. =P
@karimazeli2653
@karimazeli2653 2 жыл бұрын
Why not start with a Hardware example? That would make it less abstract, because we end up building physical things, not just software programming...
@billferner6741
@billferner6741 5 ай бұрын
Maybe this helps? I use it in a temperature measurement for calculating the average of 10 masurements. Each new data point is put in a different position of that array. Then computet the sum, decided by 10. Voila, the average temperature.
@billferner6741
@billferner6741 5 ай бұрын
I miss an example of a two-dimensional array.
@planker
@planker 2 жыл бұрын
Like! Zero, accept it and move on... It's the stupid machine that thinks it's a number, ie; 1001011. 0 has a value to it. Machines also think Green is a primary Color. Stupid machines.
@gaptoofgranny
@gaptoofgranny 10 ай бұрын
I know you need to run ads in your videos in order to make a living, I get that, but you need to either place the ad before the lesson or after. Some of us need to keep the lesson going in one continuous stream, otherwise our methods of processing information in order to learn it gets disrupted and we have to start all over again. It really is bad practice. I couldn't do that when I was teaching, otherwise my students would look at me like I grew a second head and get absolutely thrown for a loop.
Using Arrays with For Loops
17:24
Programming Electronics Academy
Рет қаралды 32 М.
What is the ? code!?  Learn about the ternary operator!
12:30
Programming Electronics Academy
Рет қаралды 12 М.
Worst flight ever
00:55
Adam W
Рет қаралды 54 МЛН
«Кім тапқыр?» бағдарламасы
00:16
Balapan TV
Рет қаралды 173 М.
小蚂蚁会选到什么呢!#火影忍者 #佐助 #家庭
00:47
火影忍者一家
Рет қаралды 71 МЛН
啊?就这么水灵灵的穿上了?
00:18
一航1
Рет қаралды 30 МЛН
LESSON 31: Understanding Arduino Arrays
29:47
Paul McWhorter
Рет қаралды 69 М.
Arduino Sketch with millis() instead of delay()
14:27
Programming Electronics Academy
Рет қаралды 229 М.
Which Arduino IDE should I use?
13:43
Programming Electronics Academy
Рет қаралды 85 М.
Arduino UNO R4 Lesson12 - millis Function | Handling Multiple Tasks | Non-Blocking Code
23:38
Arduino Basics 102: Control Structures, Variables, Interrupts
7:38
Mastering Servo Control: PCA9685 PWM Driver with Arduino Tutorial and Demo
7:50
7 Arduino Tips for New Programmers
9:41
Programming Electronics Academy
Рет қаралды 48 М.
Worst flight ever
00:55
Adam W
Рет қаралды 54 МЛН