Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (client.connect(notificationHost.c_str(), notificationPort))
- {
- client.print("GET /update?simple=true&color=");
- client.print(color);
- client.println(" HTTP/1.1");
- client.print("Host: ");
- client.println(notificationHost.c_str());
- client.println("Connection: close");
- client.println();
- }
- else
- {
- Serial.println("[E] Couldn't notify... Trying again.");
- return notifyPartner();
- }
- int initialTime = millis();
- int finalTime = millis();
- while (!client.available() && (finalTime - initialTime) < _NOTIFICATION_READ_TIMEOUT)
- finalTime = millis();
- if ((finalTime - initialTime) >= _NOTIFICATION_READ_TIMEOUT)
- {
- Serial.println("[E] No response from the partner.");
- ledOff();
- return;
- }
- String line = client.readStringUntil('|');
- while (!client.available()) {}
- line = client.readStringUntil('|');
- Serial.println(line);
- client.stop();
Advertisement
Add Comment
Please, Sign In to add comment