-->
Page 1 of 1

Trouble connecting to WIFI using "Simple HTTP get webclient"

PostPosted: Tue Feb 13, 2018 10:54 pm
by Mitch
Title says it. I'm using an ESP8266 feather huzzah from adafruit.com. I'm running their web client test from the product's details on the adafruit website. I entered my ssid and password correctly, but in the serial console it says

Connecting to WOW!8568-5G
.
ets Jan 8 2013,rst cause:4, boot mode:(3,7)

wdt reset
load 0x4010f000, len 1384, room 16
tail 8
chksum 0x2d
csum 0x2d
v09f0c112
~ld




My code is /*
* Simple HTTP get webclient test
*/

#include <ESP8266WiFi.h>

const char* ssid = "WOW!8568-5G";
const char* password = "********";

const char* host = "wifitest.adafruit.com";

void setup() {
Serial.begin(115200);
delay(100);

// We start by connecting to a WiFi network

Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);

WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}

Serial.println("");
Serial.println("WiFi connected");
Serial.println("IP address: ");
Serial.println(WiFi.localIP());
}

int value = 0;

void loop() {
delay(5000);
++value;

Serial.print("connecting to ");
Serial.println(host);

// Use WiFiClient class to create TCP connections
WiFiClient client;
const int httpPort = 80;
if (!client.connect(host, httpPort)) {
Serial.println("connection failed");
return;
}

// We now create a URI for the request
String url = "/testwifi/index.html";
Serial.print("Requesting URL: ");
Serial.println(url);

// This will send the request to the server
client.print(String("GET ") + url + " HTTP/1.1\r\n" +
"Host: " + host + "\r\n" +
"Connection: close\r\n\r\n");
delay(500);

// Read all the lines of the reply from server and print them to Serial
while(client.available()){
String line = client.readStringUntil('\r');
Serial.print(line);
}

Serial.println();
Serial.println("closing connection");
}