Skip to content

Clarified comments and debug messages in WiFiClient Example #2389

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions libraries/WiFi/examples/WiFiClientBasic/WiFiClientBasic.ino
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ void setup()

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

while(WiFiMulti.run() != WL_CONNECTED) {
Serial.print(".");
Expand All @@ -39,32 +39,30 @@ void loop()
const uint16_t port = 80;
const char * host = "192.168.1.1"; // ip or dns



Serial.print("connecting to ");
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...");
Serial.println("Connection failed.");
Serial.println("Waiting 5 seconds before retrying...");
delay(5000);
return;
}

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

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

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

Serial.println("wait 5 sec...");
Serial.println("Waiting 5 seconds before restarting...");
delay(5000);
}