Pages: [1]   Go Down
Author Topic: Printing pin names?  (Read 305 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Karma: 0
Posts: 31
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?

Global Moderator
Offline Offline
Brattain Member
Karma: 310
Posts: 26619
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__)
Serial.print (LEDcathodes[column] - 54, DEC);
Serial.print (LEDcathodes[column] - 14, DEC);
« Last Edit: July 20, 2011, 07:39:37 am by AWOL » Logged

"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.

Pages: [1]   Go Up
Jump to: