Problem with send data to online mysql database

Here is my code
At first its working but it stucks later
I want screen data refresh in real time
And data sent to database after 10 minutes
WHAT CAN I DO ?
IS MY CODE WRONG ?

I HOPE TO FIND A SOLUTION !!!

test_me_othoni_online.ino (3.73 KB)

Here is my code

Nope.

AWOL:
Nope.

#include <SPI.h>
#include <Ethernet.h>
#include “DHT.h”
#include <Adafruit_INA219.h>

#define DHTPIN 2
#define DHTTYPE DHT22
#include <Adafruit_SSD1306.h>
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
Adafruit_INA219 ina219;

DHT dht(DHTPIN, DHTTYPE);
byte mac = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip = {192, 168, 2, 3 }; //Enter the IP of ethernet shield
char serv = “********.”; //Enter the IPv4 address
EthernetClient cliente;

unsigned long time_1_screen = 0;
unsigned long time_2_screen = 0;
unsigned long INTERVAL_MESSAGE1 = 100;
unsigned long time_1_online = 0;
unsigned long time_2_online = 0;
unsigned long INTERVAL_MESSAGE2 = 600000;

const int chipSelect = 10;
void print_time(unsigned long time_millis);

void setup() {
Serial.begin(115200); //setting the baud rate at 9600
Ethernet.begin(mac, ip);
dht.begin();
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
ina219.begin();
}

void loop() {

unsigned long time_1_screen = millis();

float shuntvoltage = ina219.getShuntVoltage_mV();
float busvoltage = ina219.getBusVoltage_V();
float current_mA = ina219.getCurrent_mA();
float loadvoltage = busvoltage + (shuntvoltage / 1000);
float hum = dht.readHumidity(); //Reading the humidity and storing in hum
float temp = dht.readTemperature(); //Reading the temperature as Celsius and storing in temp
float fah = dht.readTemperature(true); //reading the temperature in Fahrenheit
float heat_index = dht.computeHeatIndex(fah, hum); //Reading the heat index in Fahrenheit
float heat_indexC = dht.convertFtoC(heat_index); //Converting the heat index in Celsius

Ethernet.begin(mac, ip);

if (time_1_screen - time_2_screen >= INTERVAL_MESSAGE1 ) {
time_2_screen = time_1_screen;
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
display.setCursor(0, 0);
display.println(loadvoltage);
display.setCursor(35, 0);
display.println(“V”);
display.setCursor(50, 0);
display.println(current_mA);
display.setCursor(95, 0);
display.println(“mA”);
display.setCursor(0, 10);
display.println(loadvoltage * current_mA);
display.setCursor(35, 10);
display.println(“mW”);
display.setCursor(0, 20);
display.println(hum);
display.setCursor(30, 20);
display.println(" % “);
display.setCursor(55, 10);
display.println(temp);
display.setCursor(80, 10);
display.println(” cel ");
display.display();
//Printing the values on the serial monitor
Serial.print("Temperature= ");
Serial.println(temp);
Serial.print("Humidity= ");
Serial.println(hum);
Serial.print("Heat Index= ");
Serial.println(heat_indexC);
Serial.print("voltage= ");
Serial.println(loadvoltage);
Serial.print("current_mA= ");
Serial.println(current_mA);
Serial.print("power= ");
Serial.println(loadvoltage * current_mA);
}
if ( time_1_screen - time_2_online >= INTERVAL_MESSAGE2 ) {
time_2_online = time_1_screen ;
if (cliente.connect(serv, 80)) { //Connecting at the IP address and port we saved before

Serial.println(“connected”);
cliente.print(“GET ********./data.php?”); //Connecting and Sending values to database
cliente.print(“temperature=”);
cliente.print(temp);
cliente.print("&humidity=");
cliente.print(hum);
cliente.print("&heat_index=");
cliente.print(heat_indexC);
cliente.print("&voltage=");
cliente.print(loadvoltage);
cliente.print("&current_mA=");
cliente.print(current_mA);
cliente.print("&power=");
cliente.println(loadvoltage * current_mA);
cliente.stop(); //Closing the connection
}
else { // if you didn’t get a connection to the server:
Serial.println(“connection failed”);
}
}
}

I want screen data refresh in real time
And data sent to database after 10 minutes
WHAT CAN I DO ?
IS MY CODE WRONG ?

Who knows? You failed to explain what the code actually does.

Why are you screaming? I'm not deaf. I have my hearing aids turned off.

PaulS:
Who knows? You failed to explain what the code actually does.

Why are you screaming? I'm not deaf. I have my hearing aids turned off.

sorry my friend
I want to send temperature-humidity-voltage-current_mA-power data to screen in real time but I want to send every 10 minutes in current time data to mysql database
Its working fine but after while it stops to send data to internet
can you help me ?

Its working fine but after while it stops to send data to internet

Why does it stop sending data? After how long? Minutes? Hours? Months?

The more precise you can be, the better the help you'll get.

The closer you come to playing by the rules, like using code tags, the more people will be inclined to want to help you.