#include <WiFi.h>
const char* ssid = "Wokwi-GUEST";
const char* password = "";
void setup() {
Serial.begin(9600);
Serial.println("Đang kết nối đến WiFi");
WiFi.begin(ssid, password, 6);
int attempts = 0;
while (WiFi.status() != WL_CONNECTED && attempts < 10) {
delay(1000);
Serial.print(".");
attempts++;
}
if (WiFi.status() == WL_CONNECTED) {
Serial.println("\nKết nối thành công!");
Serial.print("IP của thiết bị: ");
Serial.println(WiFi.localIP());
} else {
Serial.println("Không thể kết nối đến mạng Wi-Fi!");
}
}
void loop() {
}