void setup() {
  // put your setup code here, to run once:
  volatile char *dirf,*dirk;
  volatile char *outf,*ink,x;
  volatile long i,j;
  dirf = 0x30;dirk=0x107;
  outf = 0x31;ink=0x106;
  *dirf = 0x03;*dirk = 0x00;
  i=0;
  while(1){
    x=*ink;
    if((x & 0x01)==0x01){//switch pressed or not
      i++;
      for(j=0;j<100000;j++); //delay for proper operation
    }
    if(i%2) //even press
      *outf = 0x01;  //led on1
    else  //odd press
      *outf=0x02; //led 2
  }
}

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

}