Arduino Wemos D1 Cant Connect Open Wifi Hotspot

I put SSID name with blank password but still cant connect to wifi. If am using hotspot from my cellphone the its working. confused. need help please,

this is code i am using:

#define BLYNK_PRINT Serial    
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
WidgetLED PUMP(V0); 
#include "DHT.h"
#define DHTPIN 4     // pin  DATA with D4
#define SOIL_MOIST_1_PIN A0 // pin A0 with A0
#define PUMP_PIN 13   // PUMP RELAY
#define DHTTYPE DHT11   
#define DRY_SOIL      68
#define WET_SOIL      90
#define TIME_PUMP_ON  15
#define READ_SOIL_HUM_TM  10L 
#define READ_AIR_DATA_TM  2L  
#define SEND_UP_DATA_TM   10L 
#define AUTO_CTRL_TM      60L 
char auth[] = "xxxxxxxxxxx";
char ssid[] = "xxxxxxx";
char pass[] = "xxxxxxxxxx";
float humDHT = 0;
float tempDHT = 0;
int soilMoist = 0;
boolean pumpStatus = 0;
int timePumpOn = 1; 
long sampleTimingSeconds = 20; 
long startTiming = 0;
long elapsedTime = 0;
BlynkTimer timer;
DHT dht(DHTPIN, DHTTYPE);
void setup() {
   pinMode(PUMP_PIN, OUTPUT);
 aplyCmd();
  Serial.begin(115200);
  dht.begin();    
  Blynk.begin( auth, ssid , pass );
  PUMP.off();
 startTimers();
}
void loop() {
  timer.run(); 
  Blynk.run();
}
BLYNK_WRITE(3) 
{
  int i = param.asInt();
  if (i == 1)
  {
    pumpStatus = !pumpStatus;
    aplyCmd();
  }
}
void getSoilMoist(void)
{
  int i = 0;
  soilMoist = 0;
  for (i = 0; i < 10; i++)  //
  {
    soilMoist += analogRead(SOIL_MOIST_1_PIN); 
    delay(20);   
  }
  soilMoist = soilMoist / (i);
  soilMoist = map(soilMoist, 1023, 0, 0, 100); 

}
void getDhtData(void)
{
tempDHT = dht.readTemperature();
  humDHT = dht.readHumidity();
  if (isnan(humDHT) || isnan(tempDHT))   
  {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
}
void aplyCmd()
{
  if (pumpStatus == 1)
  {
    Blynk.notify("pump ON");
    digitalWrite(PUMP_PIN, LOW);
    PUMP.on();
  }

  else {
    digitalWrite(PUMP_PIN, HIGH);
    PUMP.off();
  }
}
void autoControlPlantation(void)
{
  if (soilMoist <= WET_SOIL)
  {
    turnPumpOn();
  }
}
void turnPumpOn()
{
  pumpStatus = 1;
  aplyCmd();
  delay (TIME_PUMP_ON * 500);
  pumpStatus = 0;
  aplyCmd();
}
void startTimers(void)
{
  timer.setInterval(READ_AIR_DATA_TM * 500, getDhtData);
  timer.setInterval(READ_SOIL_HUM_TM * 500, getSoilMoist);
  timer.setInterval(SEND_UP_DATA_TM * 500, sendUptime);
  timer.setInterval(AUTO_CTRL_TM * 500, autoControlPlantation);
}
void sendUptime()
{
  Blynk.virtualWrite(1, tempDHT); 
  Blynk.virtualWrite(2, humDHT); 
  Blynk.virtualWrite(3, soilMoist);
}

@indra_b3j0 please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

thanks for reminder,

So are you saying that this:

actually reads:

char pass = “”;

Connecting via a WiFi hotspot on a phone is somewhat difficult, as some mobile providers block some ports and protocols, which can stop Blynk devices talking to the Blynk server.

You could try changing your Blynk.begin command to this:

Blynk.begin( auth, ssid , pass, “blynk-cloud.com”, 8080);

This will force the use of port 8080 rather than 80, which may be blocked by your mobile ISP.

You may also wish to use a much simpler sketch. Your sketch has multiple problems with timing. The DHT11 has a maximum sampling rate of 1 reading per second (which to be honest is optimistic and I’d go for every 5 seconds) and you are trying to read it twice every half second.
You also have 4 timers attempting to call different functions at precisely the same time, which isn’t good practice.

Pete.

Actually, i want to set the pump to be active (ON) and OFF when the soil moisture reach certain values,but it cant since its still ON-OFF regularly with interval, How do i fix this please?Thanks before

As I said earlier, your code has too many timing issues, and I’ve just spotted that you have a delay in there, which makes things even more unfriendly from a Blynk point of view.

You also seem to have a liking for putting actions into separate functions, rather than simply executing all the commands you require in one function. This makes your code difficult to debug, and serves no purpose unless your functions are blocks of code that will be called from multiple places within your code.

By far the best way of coding is with a pencil and paper - mapping out the program flow and designing the functionality, then writing the blocks of code to perform these functions.
It’s also extremely helpful (to you for debugging and future enhancements and to others for basic understanding) if you use lots of in-code documentation.
Code is much easier to follow if you have your library #include commands first, followed by your variable declarations/initialisations and in-code documentation explaining what each variable does, and why.

BLYNK_WRITE callback functions should have explanations about the type of widget that is being used, what it’s function is in the app, and what actions should be taken when the widget value changes.

If you do this with your code you’ll begin to understand why it currently does what it does, and how to change that behaviour so that it does what you want it to.

Pete.