Go Down

Topic: Printing pin names? (Read 328 times) previous topic - next topic

kevind2010

Hello all! I have an array that holds pin names for analog pins (A0, A1, A2, etc) that varies by column. I'm trying to print the pin names of each column, but I'm having difficulty doing so. I know how to set up a for loop to step through the different rows of a given column, but I'm having trouble getting my outputs to actually match the pin names. The array looks like this:

byte LEDcathodes[15][16] = {A1, A0, A0, ...
                                        A2, A2, A1, ...
                                        A3, A3, A3, ...
                                        A4, A4, A4, ...}
Each column includes all of my analog pins, but omits a given pin (this is a lighting sequence). How would I go about telling the Arduino to print these pin names? My initial work looked like this:

for(int i = 0; i<=15; i++){
    Serial.print (LEDcathodes[column]); // print the sensor name.
    Serial.print(" "); // space between sensor name
    }

... but this only returns nonsense values (7 8 9 : ; < = > ? A B C D E). What am I doing wrong here?

AWOL

#1
Jul 20, 2011, 02:35 pm Last Edit: Jul 20, 2011, 02:39 pm by AWOL Reason: 1
Quote
Serial.print (LEDcathodes[column], DEC); // print the sensor name.


or, if you want them printed out as "Ax", you'd have to do something like
Code: [Select]
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
Serial.print (LEDcathodes[column] - 54, DEC);
#else
Serial.print (LEDcathodes[column] - 14, DEC);
#endif
 
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up