# Lesson 58 : What is multidimensional Array? Example of RGB LED

### Part 6: Arduino Practial Programming

In this lesson we learn about multidimensional array. Regular array is single dimension which is list of values in one variable. But when you have related values like lenght and width of objects, then we can define two dimensional array to hold lenght and width for the same object in the same index. This allows to have dimensions for example of items in a multidimensional array.
If we want for example to meausre voltage and current at different intervals of time we can use a two dimensional array. or we can use a three dimensional array two assign values of color red, green and blue for RGB LED. In the next lession we practially use it with RGB LED. Please watch the video for full details.

• 00:00 Introduction to multidimensional array
• 04:25 Reading value of a multidimensional array (this code)
• 05:50 Updating value of a multidimensional array
• 08:57 Defining 3 dimensional array
• 10:29 Dreading 3 dimensional array values
• 11:37 Updating 3 dimensional array values
• 12:39 Defining empty 3 dimensional array
``````
/*
* Lesson 58: What is multidimensional Array? RGB LED example
* example from the video to print values of multidimensionalarray

Watch video for full details of this code: https://youtu.be/YuGJpFeoq5I
*
* Written by Ahmad Shamshiri on October 20, 2019   at 14:58
* in Ajax, Ontario, Canada. www.robojax.com
*
*
*
* Get this code and other Arduino codes from Robojax.com

If you found this tutorial helpful, please support me so I can continue creating
content like this. You can support me on Patreon http://robojax.com/L/?id=63

or make donation using PayPal http://robojax.com/L/?id=64

*  * This code is "AS IS" without warranty or liability. Free to be used as long as you keep this note intact.*
This program is free software: you can redistribute it and/or modify
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/

//defining a three dimentional array with 3 rows
int shapes[3][3] = {
{16, 8, 9},
{23, 10, 7},
{41, 17, 19}
};

void setup() {
Serial.begin(9600);
Serial.print("3x3 Array");
Serial.println(shapes[1][1]);//prints 10
Serial.println(shapes[0][0]);//prints 16
Serial.println(shapes[2][2]);//prints 19
Serial.println(shapes[2][0]);//prints 41

}

void loop() {
//robojax.com loop has nothing.

}//

```  ```

The least I expect from you is to thumb up the video and subscribe to my channel. I appriciate that. .I have spent months making these lectures and writing code. You don't lose anything by subscribging to my channel. Your subscription is stamp of approval to my videos and more people can find them and in it turn it helps me. Thank you

If you found this tutorial helpful, please support me so I can continue creating content like this. support me via PayPal

**** AFFILIATE PROGRAM **** We are a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for us to earn fees by linking to Amazon.com and affiliated sites.