Led matrix issue - LED type

Hi everyone,

I have a weird issue with a led matrix 4x4 I did following this tutorial :
http://www.multiwingspan.co.uk/arduino.php?page=matrix

I wanted the led to turn on subsequently following this pattern :
1st column : 1 row -> 2nd row -> 3rd row -> 4th row
2nd column : 1st row etc...
3rd column : 1st row etc ..
4th column : 1st row -> 2nd row -> 3rd row -> 4th row

It worked perfectly fine with blue leds and then I wanted to try with OSRAM opto led sfh 4557, it goes this way :
All columns 1st rows
All columns 2nd rows
All columns 3rd rows
All columns 4th rows

If you have any ideas of what is happening,n it would help me a lot.
Just FYI, I did test, when I replace only one blue led by an IR led, the column where the led is, is turning on each time subsequently following the row pattern.

Thanks a lot for your help.

// anodes
int row[] = {4,5,6,7};
// cathodes
int col[] = {8,9,10,11};
// bit patterns for each row
byte data[] = {
0,0,0,0};
// defines the size of the matrix
int columns = 4;
int rows = 4;
int xcol = 0;
int xrow = 0;
//millisecond delay between displaying each row
int pause = 1100;
void setup()
{
Serial.begin(9600);
for (int i=0;i<4;i++)
{
pinMode(row*, OUTPUT);*
_ pinMode(col*, OUTPUT);_
_
} _
_
allOff();_
_
}_
void loop()
_
{ _
_
showPattern();_
_
}_
void allOff()
_
{_
_
for (int i=0;i<4;i++)_
_
{_
_ digitalWrite(row, LOW);
digitalWrite(col, HIGH);
}
}
void showPattern()
{
allOff();
for (int thisrow=0;thisrow<16;thisrow++)
{
xrow=((thisrow) % 4);
xcol=((thisrow) / 4);
digitalWrite(row[xrow], HIGH);
digitalWrite(col[xcol], LOW);
delay(pause);
allOff();
}
}*_

OK, just a little hint if you are going to discuss things here. :grinning:

You need to go and read the forum instructions so that you can go back and modify your original post (not re-post it) - using the "More -> Modify" option below the right hand corner of your post - to mark up your code as such using the "</>" icon in the posting window. Just highlight each section of code (or output if you later need to post that) from the IDE and click the icon.

In fact, the IDE itself has a "copy for forum" link to put these markings on a highlighted block for you so you then just paste it here in a posting window. But even before doing that, don't forget to use the "Auto-Format" (Ctrl-T) option first to make it easy to read. If you do not post it as "code" it can as you now see, easily be quite garbled and is generally more difficult to read due to the font.

It is inappropriate to attach it as a ".ino" file unless it is clearly too long to include in the post proper; yours is not. People can usually see the mistakes directly and do not want to have to actually load it in their own IDE. And even that would also assume they are using a PC and have the IDE running on that PC.

Also keep your blank space tidy. Do use blank lines, but only single blanks between complete functional blocks.

Why do we think this is more important than just having your question answered? Because it is really difficult to write code properly - as with any other task requiring care - if everything is not well organised!

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.