Troubleshoot

A couple weeks ago the following code was working:
#include <ESP8266WiFi.h>
#include "HTTPSRedirect.h"
#include "DebugMacros.h"

const char* ssid = "GUEST_MSBSD";
const char* password = "";
const byte channel = 6;
unsigned char bssid[18] = { 0xD8, 0x84, 0x66, 0x40, 0x7E, 0x49 };

const char* host = "script.google.com";
const char *GScriptId = "AKfycbxF19iZK6kJvHmdt7bpjvyfcqWS2Q-iDeCiPH0k5-vdU5B0He5y";
const int port = 443;

HTTPSRedirect* client = nullptr;

void setup() {
  Serial.begin(115200);
  Serial.setDebugOutput(true);

  WiFi.persistent(false);
  WiFi.mode(WIFI_OFF);   // this is a temporary line, to be removed after SDK update to 1.5.4
  WiFi.mode(WIFI_STA);

  WiFi.begin(ssid, password, channel, bssid);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
  }
}

void loop() {
  client = new HTTPSRedirect(port);
  client->connect(host, port);

  String url = String("/macros/s/") + GScriptId + "/exec";
  Serial.println(url);
  client->GET(url, host);
  Serial.println(client->getResponseBody());
  delete client;

  Serial.println("Waiting...");
  delay(3000);
}

Unfortunately, it no longer works. It produces the following output:
scandone
state: 0 -> 2 (b0)
state: 2 -> 0 (2)
reconnect
f 0, scandone
state: 0 -> 2 (b0)
state: 2 -> 0 (2)
reconnect
f -180, scandone
state: 0 -> 2 (b0)
state: 2 -> 0 (2)
reconnect

For this reason, I've resorted to setting up a router in my room. With it, I am able to connect without any trouble and can restrict the network I have setup using mac addresses (so that only my microcontrollers can connect to it). The only drawback is that it only works in my classroom. I'd like to teach my students to use the school's GUEST_MSBSD network so that they can set up our devices anywhere in the school, and even at other schools. Here's the working code:
#include <ESP8266WiFi.h>
#include "HTTPSRedirect.h"
#include "DebugMacros.h"

const char* ssid = "DeviceNet";
const char* password = "T333l@nd";

const char* host = "script.google.com";
const char *GScriptId = "AKfycbxF19iZK6kJvHmdt7bpjvyfcqWS2Q-iDeCiPH0k5-vdU5B0He5y";
const int port = 443;

HTTPSRedirect* client = nullptr;

void setup() {
  Serial.begin(115200);
  Serial.setDebugOutput(true);

  WiFi.persistent(false);
  WiFi.mode(WIFI_OFF);   // this is a temporary line, to be removed after SDK update to 1.5.4
  WiFi.mode(WIFI_STA);

  WiFi.begin(ssid,password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
  }
}

void loop() {
  client = new HTTPSRedirect(port);
  client->connect(host, port);

  String url = String("/macros/s/") + GScriptId + "/exec";
  Serial.println(url);
  client->GET(url, host);
  Serial.println(client->getResponseBody());
  delete client;

  Serial.println("Waiting...");
  delay(3000);
}

Here is the output:
scandone
state: 0 -> 2 (b0)
state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt 

connected with DeviceNet, channel 11
dhcp client start...
ip:10.13.7.240,mask:255.255.240.0,gw:10.13.1.1
please start sntp first !
/macros/s/AKfycbxF19iZK6kJvHmdt7bpjvyfcqWS2Q-iDeCiPH0k5-vdU5B0He5y/exec
please start sntp first !
Connection successful.

Waiting...

I'm not sure exactly what all the output means, so it's hard for me to get a start on what is causing the problem. The latest theory supplied by Robert Crowe is that the router I'm using is somehow helping the microcontrollers with DNS whereas the GUEST_MSBSD network is not. However, from what I can tell it appears that I'm not even able to connect to the GUEST_MSBSD router.

I have checked the following:
  • There is no landing page for the GUEST_MSBSD network. I disconnected from the network, cleared the cache, and reconnected to the network without issue.
  • Verified the radios are broadcasting at the 2.4 GHz frequency using WiFi Analyzer.
Comments