Wk 10 HW Exercises

Hey y’all! This week we got familiar with our Adafruit Huzzah boards as we begin to dive into the world of IoT. Had issues with the wifi, but was able to get the board to light up just fine.

I was not able to get my board to connect to the wi-fi, but I believe other people were having issues with the wi-fi connection as well. Here’s the message I got on the serial monitor every time I tried to connect.

Wait for WiFi... ...........
WiFi connected
IP address:
192.168.250.61
connecting to 192.168.1.1
connection failed
wait 5 sec...
connecting to 192.168.1.1
connection failed

Here’s a copy of my code:

// We start by connecting to a WiFi network
WiFi.mode(WIFI_STA);
WiFiMulti.addAP("MFA PoD", "il0vedesign");

Serial.println();
Serial.println();
Serial.print("Wait for WiFi... ");

while (WiFiMulti.run() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}

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

delay(500);
}

void loop() {
const uint16_t port = 80;
const char * host = "192.168.1.1"; // ip or dns

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

// Use WiFiClient class to create TCP connections
WiFiClient client;

if (!client.connect(host, port)) {
Serial.println("connection failed");
Serial.println("wait 5 sec...");
delay(5000);
return;
}

// This will send the request to the server
client.println("Send this data to server");

//read back one line from server
String line = client.readStringUntil('\r');
Serial.println(line);

Serial.println("closing connection");
client.stop();

Serial.println("wait 5 sec...");
delay(5000);
}

Thanks!
Catherine