Unable to connect Wemos Mini (ESP8266) to WiFi (retired)

Hi,

I provided api key, ssid and password. The code compiles and uploads successfully to Wemos Mini (ESP8266). However, when I view output using serial monitor, it goes into an infinite loop which displays text below:

Attempting to connect to WPA SSID: xyz
Status = 1

I am new to this programming environment, so it will be great if you could provide some clarification of what I am doing wrong. Below is my code:

#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <WifiLocation.h>
#include <NTPClient.h>
#include <WiFiUdp.h>
#include <SoftwareSerial.h>

/////////////////////////////// Settings /////////////////////////////////////////////

const char* googleApiKey = ""; // Your google geolocation api key
const char* ssid = ""; // Your Wifi SSID
const char* passwd = ""; // Your Wifi Password
const float timeZone = 8;

///////////////////////////////////////////////////////////////////////////////////////
#define sensorPin A0
//SoftwareSerial MyBlue(2, 3); // RX | TX
// Define Trig and Echo pin:
//#define trigPin 2
//#define echoPin 3
// Define variables:
unsigned long lastTime;
float distance;
boolean low, high, startup = true;
unsigned char alert = 0, event = 0;
String csv;

WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "pool.ntp.org");

WifiLocation location(googleApiKey);
location_t loc;

void setup() {
Serial.begin(9600);
Serial1.begin(9600);

Serial.println("Water Level Detector Started...");

// Connect to WPA/WPA2 network
WiFi.mode(WIFI_STA);

WiFi.begin(ssid, passwd);
while (WiFi.status() != WL_CONNECTED) {
Serial.print("Attempting to connect to WPA SSID: ");
Serial.println(ssid);
// wait 5 seconds for connection:
Serial.print("Status = ");
Serial.println(WiFi.status());
delay(500);
}

timeClient.begin();
timeClient.setTimeOffset(timeZone*3600);

pinMode(sensorPin, INPUT);

}

3 posts were merged into an existing topic: Unable to connect Wemos Mini (ESP8266) to WiFi