Go Down

Topic: Two Dimensional Arrays.... (Read 15930 times) previous topic - next topic

slimjim

Anyone know if it is possibly to have two dimensional arras on the Arduino?

Im trying to write a menu system for the LCD keypad shield.

Letting me have a list of options, that I can go deeper into... Then select something and come out again.

Anyone give me any help on this?


AlphaBeta

Code: [Select]

byte my2dArray[2][3]={
 {1,2,3},
 {2,3,4}
};

:)

Ayelix

#2
Nov 10, 2009, 05:41 am Last Edit: Nov 10, 2009, 05:43 am by Ayelix Reason: 1
How do you access the data in an array like this?  Is it like:
my2dArray[1][1] is 3
my2dArray[0][2] is 3
my2dArray[1][2] is 4?
I'm assuming both the columns and rows are zero-indexed, but I don't know about the bracket setup.

PaulS

The best way to get an answer to your question is to fire up the IDE and start typing Serial.print statements. ;)

Mike Murdock

#4
Nov 10, 2009, 02:51 pm Last Edit: Nov 10, 2009, 02:51 pm by mfm9 Reason: 1
Quote
How do you access the data in an array like this?  Is it like:
my2dArray[1][1] is 3
my2dArray[0][2] is 3
my2dArray[1][2] is 4?
I'm assuming both the columns and rows are zero-indexed, but I don't know about the bracket setup.
Ayelix, you have it exactly right.

Regards,

-Mike

Go Up