I have a problem with this Arduino code which I'm trying to send mtqq data from
the Arduino Uno R4 Wifi device to another device. The code works fine last week,
but suddenly it stop working, when I tried it today.
Serial.println writes Not connected, although it should write Connected.
It get susccessfully connected to my Wifi network from Arduino device, because it gives me an ip address. In my opinion I haven't done any changes. Also I haven't done any updates.
Does someone have any clues what can the issue?
#include <WiFiS3.h>
#include <PubSubClient.h>
IPAddress server(192, 168, 0, 239); // Local mosquito server ip adress
WiFiClient wifiClient;
PubSubClient client(wifiClient);
void setup()
{
Serial.begin(9600);
client.setServer(server, 1883);
WiFi.begin(ssid2,pass);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
}
delay(2000);
Serial.println("IP adress: ");
Serial.println(WiFi.localIP());
delay(500);
if (client.connect("arduinoClient"))
{
Serial.println("Connected.");
}
else
{
Serial.println("Not connected.");
}
}