Now, it loops forever (good). But why? PrintWifiStatus() is simply output:
void printWifiStatus() {
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print your board's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
}
So I guess my question is, why does this fix the bug, and what causes that bug in the first place? There is no reason for it stop sending after about 8 number 1’s.
For the benefit of the Arduino Community, I modified the code a bit. This allows the client to see if the server came offline for some reason, and if so, reconnects.
void printWifiStatus() {
// print the SSID of the network you're attached to:
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
// print your board's IP address:
IPAddress ip = WiFi.localIP();
Serial.print("IP Address: ");
Serial.println(ip);
// print the received signal strength:
long rssi = WiFi.RSSI();
Serial.print("signal strength (RSSI):");
Serial.print(rssi);
Serial.println(" dBm");
while (rssi ==0) {
WiFi.end();
Serial.print("RECONNECTING to connect to SSID: ");
Serial.println(ssid);
// Connect to WPA/WPA2 network. Change this line if using open or WEP network:
status = WiFi.begin(ssid, pass);
rssi = WiFi.RSSI();
// wait 10 seconds for connection:
delay(10000);
}
}
mydogcooperisapita:
Now, it loops forever (good). But why? PrintWifiStatus() is simply output:
Likely because it takes time and therefore slows down your loop. Depeding on where the network is handled e.g. a separate module. That module might still be busy. Try a short delay instead.