I have been trying to get two uno r4 boards to talk with each other but i cant even get one of them to connect to any routers, i have tried my home wifi and mobile hotspot neither of which have worked, the code just continues printing a "." when it hasnt connected yet.
#include <WiFi.h>
#include <WiFiServer.h>
char* ssid = "iphone";
char* password = "abcdefgh";
WiFiServer server(80);
void setup() {
Serial.begin(9600);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print(".");
}
Serial.println("Connected to Wi-Fi");
Serial.print("IP Address: ");
Serial.println(WiFi.localIP());
server.begin();
}
void loop() {
WiFiClient client = server.available();
if (client) {
Serial.println("Client connected");
while (client.connected()) {
if (client.available()) {
String data = client.readStringUntil('\n');
Serial.print("Received data: ");
Serial.println(data);
}
}
client.stop();
Serial.println("Client disconnected");
}
}