// Display 0 to 9999 in loop with dealy
// work done 08-03-24 to 09-03-24
void setup() {
  #define MAX 10
  

  // put your setup code here, to run once:
  volatile char *dirf,*dirk,*dira,*dirc;
  volatile char *outf,*outk,*outa,*outc;
  volatile long a[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x67};
  volatile long b[]={0xBF,0x86,0xDB,0xCF,0xE6,0xED,0xFD,0x87,0xFF,0xE7};
  volatile long i,j=9,k=9,l=9,m=1,lop1=0,lop2=0,lop3=0,xc,xa,xk,xf;
  volatile long flag1=0,flag2=0,flag3=0;
  dirf=0xFF,dirk=0xFF,dira=0xFF,dirc=0xFF;
  dirf = 0x30; outf = 0x31; 
  dirk = 0x107; outk = 0x108;
  dira = 0x21; outa = 0x22;
  dirc = 0x27; outc = 0x28;
  while(lop3<10)
  {
    lop2=0;
    k=9;
  while(lop2<10)
  {
    lop1=0;
    j=9;
   while(lop1<10)    
   { 
  for(i=9;i>=0;i--)
  {
    if(flag3!=0 && i==0)
    {
      xc=0;
      *outc=xc;
    }
    else{
         xc=a[i];
     *outc=xc;
    }
     if(flag2!=0 && j==0)
     {
      xa=0;
      *outa=xa;
      flag3++;
     }
     else{
        xa=a[j];
     *outa=xa;
     }
     if(flag1!=0 && k==0)
     {
        xk=0;
        *outk=xk;
        flag2++;
     }
     else{
         xk=a[k];
     *outk=xk;
     }
     if(l==0)
     {
      xf=0;
      *outf=xf;
      flag1++;
     }
     else
     {
          xf=a[l];
      *outf=xf;
     }
     delay(MAX);
  }
   lop1++;
   j--;
   }
   lop2++;
   k--;
  }
  lop3++;
  l--;
  }
    


}
  

  

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

}