I2C Slave command

  delay(a);               // wait for a second

Also don't do delays inside an ISR.

So what is this "x" you are sending?