Unable to connect the wifi

After running this, it told me it is not able to connect the wifi. Why this happen?

void Fan_on() {
  digitalWrite(8, HIGH);  // Set digital pin 8 HIGH
}
void Fan_off() {
  digitalWrite(8, LOW); // Set digital pin 8 LOW
}

BLYNK_WRITE(V0) // Executes when the value of virtual pin 0 changes
{
  int fan;
  fan = param.asInt();
  broadcast1(fan);  
}

void broadcast1(int &fan0)
{
  if (fan0 == 1) 
  {
    // execute this code if the switch widget is now ON
    Fan_on();
  }
  else if (fan0 == 0)
  {
    // execute this code if the switch widget is now OFF
    Fan_off();
  }
}

I know I can use another way to write it on below method, but I do need to write like this as I need to put it in mBlock. Thank you.

BLYNK_WRITE(V0) // Executes when the value of virtual pin 0 changes
{
 if (param.asInt() = 1)
{
   Fan_on();  
}
else if ((param.asInt() = 0)
{
   Fan_off();  
}

Bu putting int in front of the fan variable you are declaring fan as a local variable of type Integer.
Because it’s local then it’s value can’t be seen outside of the BLYNK_WRITE(V0) function.

You could make your life much simpler by declaring fan as a global variable and referencing it anywhere in your sketch.

What type of board are you using?
Are you using Blynk IoT or Legacy?
Are you using the IoT Edgent example?

Pete.

Thank you. I have solved the problem.

void Fan_on() {
  digitalWrite(8, HIGH);  // Set digital pin 8 HIGH
}
void Fan_off() {
  digitalWrite(8, LOW); // Set digital pin 8 LOW
}

BLYNK_WRITE(V0) // Executes when the value of virtual pin 0 changes
{
  int fan = 0;
  fan = param.asInt();
  broadcast1(fan);
}

void broadcast1(int &fan0)
{
  if (fan0 == 1) 
  {
    // execute this code if the switch widget is now ON
    Fan_on();
  }
  else if (fan0 == 0)
  {
    // execute this code if the switch widget is now OFF
    Fan_off();
  }
}