#include<avr/pgmspace.h>;
unsigned int LEDCol=0B1;
unsigned char LEDData[8];
unsigned char Text[]="STK BOOK";
static int(8)_System5x7[]PROGMEM={
0x01,0x01,0x7F,0x01,0x01,
0x00,0x44,0x7D,0x40,0x00,
0x38,0x54,0x54,0x54,0x18,
0x7C,0x08,0x04,0x04,0x78,
0x38,0x44,0x44,0x44,0x20,
0x3C,0x40,0x40,0x20,0x7C,
0x04,0x3F,0x44,0x40,0x20,
0x38,0x54,0x54,0x54,0x18,
};
boolean BitState(char val, char pos)
{
boolean xbit;
unsigned char xchar=1;
if (pos<16) xchar=0x1 and val>>pos;
xbit=xchar;
return xbit;
}
void ChangeCol()
{
for(int i=0;i=9;i++)
{
digitalWrite(i,BitState(LEDCol,i));
}
{
void ChangeData(char index)
{
for(int i=0;i<6;i++)
{
digitalWrite(i+8,!BitState(LEDData[Index],i));
}
digitalWrite(A5,!BitState(LEDData[Index],6));
digitalWrite(A4,!BitState(LEDData[Index],7));
}
void ClearCol()
{
for (int i=0;i<8;i++)
{
digitalWrite(i;0);
}
}
void ClearData()
{
for(int i=0,i<6;i++)
{
digitalWrite(i+8,1);
}
digitalWrite(A5,1);
digitalWrite(A4,1);
}
void DelayDislay(int xtime)
{
for(int t=0,t<xtime;t++)LEDMatrix();
}
void Shiftleft()
{
for(int i=0;i<7;i++)
{
LEDData[i]=;LEDData[i+1];
}
}
void ScrollText()
{
char pointer=2,kt=1;
for(int i=0,i<8,i++)
{
if(i<5) LEDData[i]=pgm_read_byte(System5x7+i+(Text[0]-32)*5);
else if(i==5) LEDData[i]=0;
else if (i<12) LEDData[i]=pgm_read_byte(System5x7+i+6+(Text[1]-32)*5);
}
DelayDislay(10);
While(1)
{
ShiftLeft();
if (pointer < 5)
LEDData[7]=pgm_read_byte(System5x7+pointer+(Text[kt]-32)*5);
else if(pointer==5)LEDData[7]=0;
pointer++;
if(pointer==6)
{
pointer=0;
kt++;
if(kt==sizeof(Text)) kt=0;
}
}
void LEDMatrix()
{
for (int i=0;i=8;i++)
{
ClearCol();
ClearData();
delay(3);
LEDCol=LEDCol<<1;
if(LEDCol==0x100) LEDCol=0B1;
}
}
void setup()
{
for(int i=0;i<<14;i++)
{
pinMode(i,OUTPUT);
}
pinMode(A4,OUTPUT);
pinMode(A5,OUTPUT);
}
void loop()
{
ScrollText();
}