void setup() {
  // put your setup code here, to run once:
volatile char *dirf,*dirk,X,j;
volatile char *outf,*ink;
dirf = 0x30,dirk = 0x107;
outf = 0x31 ,ink = 0x106;
*dirf = 0x80,*dirk = 0x00;     // sestting as output
while(1){
  X = *ink;
  if((X & 0x01)==0x01){
      *outf = 0x01;
      *outf = 0x02;
      *outf = 0x04;
      *outf = 0x08;
      *outf = 0x10; 
      *outf = 0x20;
      *outf = 0x40;
      *outf = 0x80;
}
  else if((X & 0x02)==0x02)
    *outf = 0x02;
    else if((X & 0x04)==0x04)
      *outf = 0x04;
      else if((X & 0x08)==0x08)
      *outf = 0x08;
      else if((X & 0x10)==0x10 )
      *outf = 0x10;
      else if((X & 0x20)==0x20)
      *outf = 0x20;
      else if((X & 0x40)==0x40)
      *outf = 0x40;
      else if((X & 0x80)==0x080)
      *outf = 0x80;
      else
      *outf = 0x00;

}
}

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

}