Using Arrays with Arduino

  Рет қаралды 31,355

Programming Electronics Academy

Programming Electronics Academy

Күн бұрын

Пікірлер: 41
@frazier283
@frazier283 3 жыл бұрын
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 6 ай бұрын
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 6 ай бұрын
So glad it helped!!!
@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!
@KW-ei3pi
@KW-ei3pi 7 ай бұрын
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 7 ай бұрын
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 4 ай бұрын
WELL DONE! Now I’m ready to use arrays. Thanks!
@programmingelectronics
@programmingelectronics 4 ай бұрын
Great!
@ChadKapper
@ChadKapper 3 жыл бұрын
This a super-valuable lesson! Thank you!
@programmingelectronics
@programmingelectronics 3 жыл бұрын
Thanks Chad!
@voytechj
@voytechj 3 жыл бұрын
@7:10 other elements will be initialized with default value, and for a type of byte it will be zero.
@leythecg
@leythecg 3 жыл бұрын
Very well explained! Thanks very much!
@programmingelectronics
@programmingelectronics 3 жыл бұрын
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.
@peterlyne9378
@peterlyne9378 Жыл бұрын
Thank you so much, very well explained
@felixcosty
@felixcosty 3 жыл бұрын
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 3 жыл бұрын
Glad you liked the vid! Thanks for the recommendation on the joy stick library!
@tharchit9028
@tharchit9028 11 ай бұрын
THANKS MY DEAR !
@programmingelectronics
@programmingelectronics 11 ай бұрын
Thanks for watching!
@joshuapitong899
@joshuapitong899 2 жыл бұрын
Really helpful.🙌
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Glad it was helpful!
@jaysonbutcher1178
@jaysonbutcher1178 2 жыл бұрын
Thank you! You explain it well. ;)
@programmingelectronics
@programmingelectronics 2 жыл бұрын
Thanks so much for the note!!
@midianalbertokhaiyow8195
@midianalbertokhaiyow8195 3 жыл бұрын
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 3 жыл бұрын
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 3 жыл бұрын
@@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 3 жыл бұрын
@@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 3 жыл бұрын
@@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!
@NautilusAdventures1
@NautilusAdventures1 8 ай бұрын
Really video, thanhs !
@learn3715
@learn3715 3 жыл бұрын
Great upload video! 👍 stay connected! 😍Like 👍👍👍
@programmingelectronics
@programmingelectronics 3 жыл бұрын
Thanks so much!
@platine141
@platine141 3 жыл бұрын
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 3 жыл бұрын
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 7 ай бұрын
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 7 ай бұрын
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 Жыл бұрын
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
Рет қаралды 33 М.
Using Serial.parseInt() with Arduino
15:39
Programming Electronics Academy
Рет қаралды 49 М.
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 651 М.
А я думаю что за звук такой знакомый? 😂😂😂
00:15
Денис Кукояка
Рет қаралды 6 МЛН
What is the ? code!?  Learn about the ternary operator!
12:30
Programming Electronics Academy
Рет қаралды 12 М.
LESSON 31: Understanding Arduino Arrays
29:47
Paul McWhorter
Рет қаралды 69 М.
Which Arduino IDE should I use?
13:43
Programming Electronics Academy
Рет қаралды 86 М.
Arduino MASTERCLASS | Full Programming Workshop in 90 Minutes!
1:25:31
Programming Electronics Academy
Рет қаралды 2,7 МЛН
How to Use Millis to Master Arduino Multi-tasking
50:17
Rachel De Barros
Рет қаралды 61 М.
Doing multiple timed things with Arduino: Unleash the millis()!
12:25
Programming Electronics Academy
Рет қаралды 126 М.
I Made an Electronic Chessboard Without Turns
14:32
From Scratch
Рет қаралды 860 М.
Optimizing Arduino Code: no setup(), no loop() ⛔
9:27
Wokwi
Рет қаралды 210 М.
Using tabs to organize code with the Arduino IDE
12:18
Programming Electronics Academy
Рет қаралды 61 М.
Арыстанның айқасы, Тәуіржанның шайқасы!
25:51
QosLike / ҚосЛайк / Косылайық
Рет қаралды 651 М.