Use conditional-compilation to assign LED matrix polarity as appropriate

To assign correct LED matrix polarity, #define or comment-out ROWS_ARE_CATHODES
as appropriate for your particular matrix. I put this in Arduino's RowColumnScanning sketch
to accommodate either polarity as needed.

Note: Giving these constants meaningful names rather than using 'HIGH' or 'LOW'
decouples the >meaning< from the >implementation,< making your code easier to
read. Depending the matrix polarity used, HIGH or LOW does not tell you whether the
LED will light or not. ~_ON and ~_OFF indicates it clearly. Make the appropriate symbol
substitutions farther down in the code, ie, where the LEDs are to light, use PIXEL_ON,
where the code turns them off, PIXEL_OFF, etc.


// #define if rows are cathodes/cols are anodes. Comment-out if reversed.
#define ROWS_ARE_CATHODES // Comment-out for Lumex part mentioned in sketch.

#ifdef ROWS_ARE_CATHODES
// Rows are cathodes, columns are anodes
const uint8_t ROW_OFF = HIGH;
const uint8_t ROW_ON  = LOW;
const uint8_t COL_OFF = LOW;
const uint8_t COL_ON  = HIGH;
#else // Else rows are anodes, columns are cathodes
const uint8_t ROW_OFF = LOW;
const uint8_t ROW_ON  = HIGH;
const uint8_t COL_OFF = HIGH;
const uint8_t COL_ON  = LOW;
#endif
const uint8_t PIXEL_OFF = COL_OFF;
const uint8_t PIXEL_ON  = COL_ON;

...

Hope you found this useful.
-PW

Apparently you didn't read the sticky on how to post code.