#include <WiFi.h>
#include <WiFiClient.h>
const char* host = "svp.pp.ua";
const uint16_t port = 80;
WiFiClient client;
void setup() {
//Завдання №1
Serial.begin(115200);
Serial.print("Connecting to WiFi");
WiFi.begin("Wokwi-GUEST", "");
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}
Serial.println(" Connected!");
//Завдання №2
// Serial.print("IP-address: ");
// Serial.println(WiFi.localIP());
// Serial.print("Network mask: ");
// Serial.println(WiFi.subnetMask());
// Serial.print("Gateway address: ");
// Serial.println(WiFi.gatewayIP());
// Serial.print("DNS address: ");
// Serial.print(WiFi.dnsIP());
//Завдання №3
// if (client.connect(host, port)) {
// Serial.println("Successful TCP connection to the server");
// } else {
// Serial.println("Failed to establish TCP connection with the server");
// }
}
void loop() {
//Завдання №4/5/6
// if (client.connected() || client.connect(host, port)) {
// Serial.println("Запит до сервера\n");
// client.println("GET /iot.php HTTP/1.0");
// client.println("Host: svp.pp.ua");
// client.println();
// delay(1000);
// while (client.available()) {
// char x = client.read();
// Serial.print(x);
// }
// client.stop();
// } else {
// Serial.println("Failed to establish TCP connection with the server");
// }
// delay(5000);
}