Hi guys,
In most of my Arduino program I will always try to implement array. Array had help me to minimise my code substantially all this while. I notice that I have always been using array like the example below:
const uint8_t switchPin [] = { 3, 4, 5, 6, 7, 8, 9};
const uint8_t numOfSwitch = sizeof ( switchPin ) / sizeof ( uint8_t );
anyway I always wanted to know do we get a multi dimensional array index?
such example
const uint8_t RGBCPin [][] =
{
( 2, 3, 4, 5),
( 5, 3, 4, 2),
( 2, 5, 4, 3),
( 2, 3, 5, 4),
};
const uint8_t numOfSwitch = sizeof ( RGBCPin ) / sizeof ( uint8_t );
I know I will get back 16 cause the number of element in the array is 16 , But what I looking for is the value in X and Y in the following line.
const uint8_t RGBCPin [Y][X] =
{
( 2, 3, 4, 5),
( 5, 3, 4, 2),
( 2, 5, 4, 3),
( 2, 3, 5, 4),
};
such that some coding magic allow me to get the size of the array ( the value of X and Y ) without directly specifying before hand making it much more flexible for future expansion.
for does that asking This is a very simple code for charlieplexing.