I am trying to use the sketch on this page to drive a 7x5 matrix display. It indicates the option of driving a display of the opposite polarity as a discussion question but does not answer it. I have tried to solve it but without success and my requests to the site for any further info are not replied to.
// mBuf - 2 dimensional array (7 rows, 5 columns)
byte mBuf[7][5] = {
{0, 0, 1, 0, 0}, // 0
{0, 1, 0, 1, 0}, // 1
{0, 0, 1, 0, 0}, // 2
{0, 0, 1, 0, 0}, // 3
{1, 0, 0, 0, 1}, // 4
{0, 1, 1, 1, 0}, // 5
{0, 0, 1, 0, 0} // 6
};
int rowPins[7] = {2,4,5,6,9,11,12};//{7, 8, 9, 10, 11, 12, 13}; // array that holds row pin assignments
int colPins[5] = {1,3,7,8,10};//{2, 3, 4, 5, 6}; // array that holds column pin assignments
void setup() {
// put your setup code here, to run once:
for (int c = 0; c < 5; c++)
{
pinMode(colPins[c], OUTPUT); // initalize column pins
}
for (int r = 0; r < 7; r++) // initialize row pins
{
pinMode(rowPins[r], OUTPUT);
}
}
void loop() {
// put your main code here, to run repeatedly:
refreshMatrix();
}
void refreshMatrix() // send the contents of mbuff to the matrix display
{
for (int c = 0; c < 5; c++)
{
setRowPins(c);
digitalWrite(colPins[c], HIGH);
delay(2);
digitalWrite(colPins[c], LOW);
}
return;
}
void setRowPins(int c) // Set the row pins to mbuff column values
{
int r;
for (r = 0; r < 7; r++)
{
digitalWrite(rowPins[r], mBuf[r][c]);
}
return;
}
My pins are different to the ones on the web site but I have altered them in the above sketch to fit in with the ones I am using. Can anyone see what alterations are needed to drive a 7x5 LED matrix with ACCR?