ok, I already addressed a similar question, spent another month looking for a problem, but I could not solve it. arduino uno and shield 2 (W5500) I control a fan that carries warm air into the room, at a random moment it turns off, maybe after an hour, half an hour, a day or two, to control the connection, I added the timer_control function that checks the status every 10 minutes connection, it helps, but the connection is still lost, I used the ping command in Linux, thinking that the board disappears from the network, but everything is ok with the board. I can use example
arduino_etnernet_manual for W5500?
#include <SPI.h>
#include <Ethernet2.h>
#include <BlynkSimpleEthernet2.h>
#include <Arduino.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#include <OneWire.h>
#define ONE_WIRE_BUS 2
#define term_power 4
#define VENT 7
char auth[] = "";
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
BlynkTimer timer_Send;
BlynkTimer timer_control;
BlynkTimer timer_logic;
int need_temp = 0;
int gester = 0;
void logic();
void control_connect();
void Send();
void setup()
{
sensors.begin();
pinMode(term_power, OUTPUT);
pinMode(VENT, OUTPUT);
Blynk.begin(auth);
timer_Send.setInterval(3031, Send);
timer_control.setInterval(600000UL,control_connect);
timer_logic.setInterval(3013,logic);
}
BLYNK_WRITE(V0)
{
need_temp = param.asInt();
}
BLYNK_WRITE(V1)
{
gester = param.asInt();
}
BLYNK_CONNECTED()
{
Blynk.syncAll();
}
double temp()
{
digitalWrite(term_power, HIGH);
sensors.requestTemperatures();
sensors.requestTemperatures();
double real_temp = double(sensors.getTempCByIndex(0));
digitalWrite(term_power, LOW);
return real_temp;
}
void control_connect(){
bool conect = Blynk.connected() ;
if (conect != true)
{
Blynk.connect(30);
}
}
void logic()
{
double t_value = temp();
if (t_value < need_temp - gester)
{
digitalWrite(VENT, HIGH);
}
if (t_value > need_temp + gester)
{
digitalWrite(VENT, LOW);
}
}
void Send()
{
double t_value = temp();
Blynk.virtualWrite(V2, t_value);
}
void loop()
{
Blynk.run();
timer_Send.run();
timer_control.run();
timer_logic.run();
}