Hi all,
i have an arduino mega 2560 and i got the wrobot 16x16 led matrix from emartee.com
Can anyone tell me how to use it?
there is no documentation nowhere...
thanx :-/
Hi all,
i have an arduino mega 2560 and i got the wrobot 16x16 led matrix from emartee.com
Can anyone tell me how to use it?
there is no documentation nowhere...
thanx :-/
Arduino 16*16 Dot Matrix LED:
On the bottom of the side you can read:
Arduino <---> Led Matrix
Connect digital pin 4,5,6,7 to input pin OIA,OIB,OIC,OID of LED screen, which choose the row.
Connect digital pin 8,9,10 to pin SER,SCK,RCKof screen, which input the data of a row.
Connect GND and VCC to power.
This program is displaying words moving from left to right.
#define SPEED 6 //Speed of rolling. The bigger,the slower
#define WordNO 12 //number of letters(here one letter on one screen) you want to display + Screen number
#define ScreenNO 4 //define the screen number used
byte HZ[]={
//===== You have to give 32*ScreenNo 0xff bytes as follows,here 4 screens =====
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
//=============================================================================
/*0xff,0xff,0x80,0x01,0x80,0x01,0x9f,0xff,0x9f,0xff,0x9f,0xff,0x9f,0xff,0x80,0x03,
0x80,0x03,0x9f,0xff,0x9f,0xff,0x9f,0xff,0x9f,0xff,0x80,0x01,0x80,0x01,0xff,0xff, //"E"
0xff,0xff,0x9f,0xff,0x9f,0xff,0x9f,0xff,0x9f,0xff,0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7,0xcf,0xe3,0x8f,0xf0,0x0f,0xf8,0x27,0xff,0xff,0xff,0xff,//"u"
0xff,0xff,0xfe,0x7f,0xfe,0x7f,0xff,0xff,0xfe,0x7f,0xfe,0x7f,0xfe,0x7f,0xfe,0x7f,
0xfe,0x7f,0xfe,0x7f,0xfe,0x7f,0xfe,0x7f,0xfe,0x7f,0xfe,0x7f,0xff,0xff,0xff,0xff,//"i"
0xff,0xff,0xff,0xff,0xf8,0x3f,0xf0,0x1f,0xe3,0x8f,0xe7,0xcf,0xe7,0xcf,0xe7,0xcf,
0xe7,0xcf,0xe7,0xcf,0xe7,0xcf,0xe7,0xcf,0xe7,0xc7,0xff,0xff,0xff,0xff,0xff,0xff,//"n"
0xff,0xff,0xff,0xff,0xf8,0x3f,0xf0,0x1f,0xf3,0x9f,0xe7,0xcf,0xe7,0xcf,0xe7,0xcf,
0xe7,0xcf,0xe7,0xcf,0xe7,0xcf,0xf3,0x9f,0xf0,0x1f,0xf8,0x3f,0xff,0xff,0xff,0xff//"o"
};
byte BUFF[2*ScreenNO+2];
byte col,disrow; //col--moving pointer;disrow--scanning row
unsigned int wordnumber; //the bytes of words you want to display
int Dpin[]={4,5,6,7};
int OOE=2;
int RCK=10;
int SCK=9;
int SER=8;
int VCC=11;
int GND=3;
void setup()
{
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
//Serial.begin(9600);
digitalWrite(OOE,HIGH);
digitalWrite(VCC,HIGH);
digitalWrite(GND,LOW);
digitalWrite(SCK,LOW);
}
void loop()
{
byte i;
col=0;wordnumber=0;
while(1)
{
while(col<16) // circulate for 16 time, which is moving a letter through a creen
{
for(i=0;i<SPEED;i++) //the time of static display for a letter
{
for(disrow=0;disrow<16;disrow++) //scanning the row
{
digitalWrite(OOE,HIGH);
digitalWrite(RCK,LOW);
loadoneline(); //load the data of a row
sendoneline(); //send the data of a row
sendPin(disrow);
digitalWrite(OOE,LOW); // enable the row scanning
digitalWrite(RCK,HIGH); //light a row
delay(1);
}
}
col++; //moving pointer
}
col=0;
wordnumber+=32; // point to the next word
if(wordnumber>=WordNO*32)wordnumber=0; //while all the letters are dispalyed, back to the beginning
}
}
/***************** load the data of a row *****************/
void loadoneline( )
{
byte s;
unsigned int k;
for(s=0;s< ScreenNO+1;s++)
{
k = wordnumber+32*s+2*disrow;
if (k>=WordNO*32)k -= WordNO*32;
BUFF[2*s]=HZ[k];
BUFF[2*s+1]=HZ[k+1];
}
}
/*************** send the data of a row *******************/
void sendoneline( )
{
byte s;
byte inc;
if(col<8)inc=0;else inc=1;
for(s=2*ScreenNO+inc;s>=1+inc;s--)
{
sendUtra(two_onechar(BUFF[s-1],BUFF[s]));
}
}
/*********** generate data which makes word moving ************/
byte two_onechar(byte h1,byte h2)
{
byte temp,tempcol;
if(col<8) tempcol=col;
else tempcol=col-8;
temp=(h1<<tempcol)|(h2>>(8-tempcol));
//temp=255-temp;
return temp;
}
/***************************************************************/
void sendPin(byte j)
{
for (int n=0;n<4;n++)
{
if((0x01&j) < 0x01)
{digitalWrite(Dpin[n],LOW);}
else
{digitalWrite(Dpin[n],HIGH);}
j>>=1;
}
}
/**************************************************************/
void sendUtra(byte j)
{
for (int n=0;n<8;n++)
{
digitalWrite(SCK,LOW);
if((0x01&j) < 0x01)
{digitalWrite(SER,LOW);}
else
{digitalWrite(SER,HIGH);}
j=j>>1;
digitalWrite(SCK,HIGH);
//delay(1);
}
}
You must set
#define ScreenNO 4 //define the screen number used
to the numbers of screens you used. Only one, you must change it into
#define ScreenNO 1 //define the screen number used
Here is some function which moves the words from right to left:
/***************** load the data of a row *****************/
void loadoneline( )
{
byte s;
unsigned int k;
for(s=0;s< ScreenNO+1;s++)
{
k = wordnumber+32*s+2*disrow;
if (k>=WordNO*32)k -= WordNO*32;
BUFF[2*s+1]=HZ[k];
BUFF[2*s]=HZ[k+1];
}
}
/*************** send the data of a row *******************/
void sendoneline( )
{
byte s;
byte inc;
if(col<8)inc=0;else inc=1;
for(s=1+inc;s<=2*ScreenNO+inc;s++)
{
sendUtra(two_onechar(BUFF[s-1],BUFF[s]));
}
}
/******* generate data which makes word moving ************/
byte two_onechar(byte h1,byte h2)
{
byte temp,tempcol;
if(col<8) tempcol=col;
else tempcol=col-8;
temp=(h1>>tempcol)|(h2<<(8-tempcol));
return temp;
}
Hi -
thank you for the help - i guess i missed it.
What are the pins in case i have arduino mega?
I think they are the same !
What's IC control the LEDs ?
Hello friends,
I got everything working now.
I just need to ask about the code "Megaionstorm" wrote.
It's a stand alone one or should i add it to the original code?
because i keep getting this compiler errors...
thankx
The functions in the second code replace the similar functions in the first code !
You can find the original code here:
hi everybody,
i started a new program.
i used the formaly posted sendUtra function and SendPin functions.
i've manipulated sendUtra a little to work with integers (16 bit sent to the function) :
void sendUtra(int j)
{
for (int n=0;n<16;n++)
{
digitalWrite(SCK,LOW);
if((0x01&j) < 0x01)
{digitalWrite(SER,LOW);}
else
{digitalWrite(SER,HIGH);}
j=j>>1;
digitalWrite(SCK,HIGH);
}
}
(GetRowInMatrix get an int from my array by row)
i have a 16 rows array of ints (16X16 bits overall)
my loop looks like this:
for (byte scrrow = 0; scrrow <= 15; scrrow++)
{
digitalWrite(OOE,HIGH);
digitalWrite(RCK,LOW);
sendUtra (GetRowInMatrix(scrrow)); // Writing bits to a column
sendPin(scrrow); // writing bits to a row
digitalWrite(OOE,LOW); // enable the row scanning
digitalWrite(RCK,HIGH); //light a row
delay(100);
}
for some reason all i can see is one row at a time.
not all the LED screen at once.
can anyone help?
You can only light up the leds from one row at once.
After that you switch to the next row and light up their leds.
This is what you must do with all 16 row after each other.
This 50 - 60 times a second !
Row-columm Scanning to control an 8x8 LED Matrix: