void setup() {
  // put your setup code here, to run once:
  volatile unsigned long int *ind=0x29,*ddrb=0x24,*ddrd=0x2a,*outb=0x25,*outd=0x2b,i=1,m;
  *ddrb=0xff;
  *ddrd=0xf0;
  volatile unsigned long int j=32,tot=0,k=0,fl,l;
  while(1){
    // *outb=0x0f;
    fl=0;
    while(fl!=1){
      while(k<i){
        if(k==6){
          *outd=128;
         // *outb=0xff;
          for(m=0;m<70000;m++);
          *outd=0;
          *outb=0;
          fl=1;
          break;
        }
        tot=tot+j;
        l=(*ind & 0x08);
        if(l!=0x08){
        *outb=j;
        }
        else{
          *outb=tot;
        }
        for(m=0;m<70000;m++);
        j=j/2;
        k++;
        
      }
       *outb=0;
       for(m=0;m<70000;m++);
      k=0;
      i++;
      tot=0;
      j=32;
    }
    i=1;
  }

}

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

}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
led1:A
led1:C
led2:A
led2:C
led3:A
led3:C
led4:A
led4:C
led5:A
led5:C
led6:A
led6:C
led7:A
led7:C
sw1:1
sw1:2
sw1:3
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
r1:1
r1:2