void moving_charac_A(char);

void moving_charac_L(char);

void moving_charac_F(char);



void setup() {
  // put your setup code here, to run once:
   
   volatile long k, d, k1;

   volatile char p, q;

   volatile char j;

   volatile char k2;

   volatile char *dirf, *dira;
   volatile char *outf, *outa;

   dirf = 0x30; dira = 0x21;
   
   outf = 0x31; outa = 0x22;

   *dirf = 0xFF; *dira = 0xFF; 


   for (k1=0; k1<200; k1++)
   {
    
    for (k2=0; k2<2; k2++)
    {
    
    moving_charac_A(k2);

    }

    for (k2=2; k2<=4; k2++)
    {
 
      moving_charac_A(k2);

      moving_charac_L(k2-2);
    }

    
    for (k2=5; k2<12; k2++)
    {
 
      moving_charac_A(k2);
           
      moving_charac_L(k2-2);

      moving_charac_F(k2-5);

    }

    

    
    
    }
   }
   


void loop() {
  // put your main code here, to run repeatedly:

}




void moving_charac_A(char j)
{

   volatile char *outf, *outa;


   outf = 0x31; outa = 0x22;

   volatile char i, i1;

   volatile long k1;


   volatile char row_A[3] = {0x3F, 0x9F, 0x3F};

   volatile char col_A[3] = {0x01, 0x02, 0x04};

   
    for (i1=0; i1<20; i1++)
    {
      for (i=0; i<3; i++)
      {

    *outa = row_A[i];

    *outf = (col_A[i] << j);

    delay(5);

    //for(k1=0; k1<2000; k1++);

    *outf = 0x00;

   }
  
}

}


void moving_charac_L(char j)
{

   volatile char *outf, *outa;


   outf = 0x31; outa = 0x22;

   volatile char i, i1;

   volatile long k1;


   volatile char row_L[2] = {0x1F, 0x7F};

   volatile char col_L[2] = {0x01, 0x02};

   
    for (i1=0; i1<20; i1++ )
    {
      for (i=0; i<2; i++)
      {
       if (j<0)
       {

        *outf = 0x00;

       }

    *outa = row_L[i];

    *outf = (col_L[i] << j);

    delay(5);

    //for(k1=0; k1<2000; k1++);

    *outf = 0x00;

   }
  
}


}

void moving_charac_F(char j)
{

   volatile char *outf, *outa;


   outf = 0x31; outa = 0x22;

   volatile char i, i1;

   volatile long k1;


   volatile char row_F[3] = {0x1F, 0x9F, 0x9F};

   volatile char col_F[3] = {0x01, 0x02, 0x04};

   
    for (i1=0; i1<20; i1++ )
    {
      for (i=0; i<3; i++)
      {
      if (j<0)
       {

        *outf = 0x00;

       }

    *outa = row_F[i];

    *outf = (col_F[i] << j);

    delay(5);

    //for(k1=0; k1<2000; k1++);

    *outf = 0x00;

   }
  
}


   

}