This is my first attempt at Arduino-related wireless stuff, and I'm just at a loss why it doesn't work. Here's the code:
#include <ESP8266WiFi.h>
#ifndef STASSID
#define STASSID "DATACENTER"
#define STAPSK "aardvark"
#endif
const char* ssid = STASSID;
const char* password = STAPSK;
const char* host = "djxmmx.net";
const uint16_t port = 17;
void setup() {
delay(10000);
Serial.begin(115200);
// We start by connecting to a WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
/* Explicitly set the ESP8266 to be a WiFi-client, otherwise, it by default,
would try to act as both a client and an access-point and could cause
network-issues with your other WiFi-devices on your WiFi-network. */
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
The flashing goes fine, but I just get a never-ending series of dots on serial from that While loop. So it's not connecting to the router. My computer and phone both connect fine to the router using the same SSID and password. And yes, I'm sure the SSID is uppercase, and the password is lowercase.
So here's what I have:
Genuine Lolin D1 Mini (from their Aliexpress store), v3.1. Brand new.
Arduino 1.8.8, Portable
ESP8266 by Community v2.5.2
Buffalo router - 802.11g, 2.4GHz only, WPA2, channel 11
Windows 7/64
I guess it could be a bad Mini, but more likely it's something I'm doing wrong, or something isn't compatible. But I'm at a loss. Can anyone bail me out here?
Edit: I looked at my router's log, and found this entry repeated over and over again every four seconds while trying to connect with the Mini:
2019/10/27 20:56:08 WIRELESS wl0: 11g : DeAuthentication (rcvd. station leaving) User - 2c:f4:32:4a:5f:45 \
That User MAC addrress is the address of my Mini. So the wifi is working, and it is trying to connect, but apparently is being dumped by the router. No indication of why.