220v/110v AC Dimmer/Speed controller for ESP8266

//ZERO----2
//DIMMER----11


int i;
int ZDpin=0;
void setup(){
  Serial.begin(9600);
  pinMode(A0,INPUT);
  pinMode(11,OUTPUT);
  pinMode(13,OUTPUT);
  pinMode(10,OUTPUT);
}

void light(){
  delay(3);
  digitalWrite(10,1);
}

void loop(){
  i=digitalRead(10);
  digitalWrite(13,0);
  digitalWrite(10,0);
  attachInterrupt(ZDpin,light,RISING);
  delay(20);
  if(i==1){
    delay(3);
      digitalWrite(13,1);
      pwm();

  }
}

void pwm()
{
  for (int a=0; a<=255;a++)                
  {
    analogWrite(11,a);
    delay(8);                                         
  }
    for (int a=255; a>=0;a--)             
  {
    analogWrite(11,a);
    delay(8);                             
  }
  delay(800);           
}

From here