voici mon code :
#include <DHT.h>
#include <Ethernet.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include “Adafruit_BMP280.h”
Adafruit_BMP280 bmp; // I2C
/*//For SPI connection!
#define BMP_SCK 13
#define BMP_MISO 12
#define BMP_MOSI 11
#define BMP_CS 10
//Adafruit_BMP280 bme(BMP_CS); // hardware SPI
//Adafruit_BMP280 bme(BMP_CS, BMP_MOSI, BMP_MISO, BMP_SCK);
*/
byte mac = { 0x90, 0xA2, 0xDA, 0x0F, 0xDF, 0xAB };
byte ip = {192, xxx, x, xxx};
EthernetClient client;
#define DHTPIN 9
#define DHTTYPE DHT22
DHT dht(DHTPIN, DHTTYPE);
long previousMillis = 0;
unsigned long currentMillis = 0;
long interval = 250000;
float t = 0;
int h = 0;
float pressure;
float pression;
float temp;
float hic;
float temperature;
float pvap; //To store the temperature (oC)
float trose;
float tr1;
float tr2;
float tr3;
float pr1;
float pr2;
float pr3;
float ind6;
float ind5;
float ind4;
float pr5;
float pr4;
float tr4;
float ind3;
float ind2;
float ind1;
float ind7;
float ind8;
int i;
float rose[57][2]={
-60, 0.001,
-40, 0.13,
-20, 1.03,
-18, 1.5,
-15, 1.9,
-12, 2.4,
-10, 2.6,
-9, 3,
-7, 3.7,
-4, 4.6,
-1, 5.6,
0, 6.11,
2, 7.06,
4, 8.13,
6, 9.35,
8, 10.73,
10, 12.28,
11, 13.12,
12, 14.02,
13, 14.97,
14, 15.98,
15, 17.05,
16, 18.18,
17, 19.37,
18, 20.63,
19, 21.97,
20, 23.38,
21, 24.87,
22, 26.43,
23, 28.09,
24, 29.83,
25, 31.67,
26, 33.6,
27, 35.64,
28, 37.8,
29, 40.05,
30, 42.43,
31, 44.92,
32, 47.55,
33, 50.3,
34, 53.19,
35, 56.23,
36, 59.41,
37, 62.75,
38, 66.25,
39, 69.92,
40, 73.75,
41, 77.78,
42, 81.99,
43, 86.39,
44, 91.01,
45, 95.83,
46, 100.86,
47, 106.12,
48, 111.6,
49, 117.35,
50, 123.34};
String data;
void setup() {
Serial.begin(9600);
bmp.begin();
Ethernet.begin (mac, ip);
dht.begin();
delay(10000);
h = (int) dht.readHumidity();
t = (float) dht.readTemperature();
pressure = (float) bmp.readPressure();
pression = (float) pressure/100;
temp = (float) bmp.readTemperature();
hic = (float) dht.computeHeatIndex(t, h, false);
i=57;
while(t<=(rose*[0]))*
- {*
- i–;*
- }*
_ Serial.println(rose*[0]);_
_ tr1 = (float) rose[0];
tr2 = (float) rose[i+1][0];
pr1 = (float) rose[1];
pr2 = (float) rose[i+1][1];
ind1 = (float) tr2-tr1;
ind2 = (float) pr2-pr1;
ind3 = (float) t-tr1;
pr3 = (float) pr1+((ind2ind3)/ind1);
pvap = (float) pr3*h/100;_
* i=57;*
_ while(pvap<=rose*[1])
{
i–;
}
tr3 = (float) rose[0];
tr4 = (float) rose[i+1][0];
pr4 = (float) rose[1];
pr5 = (float) rose[i+1][1];
ind4 = (float) tr4-tr3;
ind5 = (float) pr5-pr4;
ind6 = (float) pvap-pr4;
trose = (float) tr3+ind5ind6/ind4;_
* data = “”;*
}
void loop(){
* i=56;*
* h = (int) dht.readHumidity();*
* t = (float) dht.readTemperature();*
* pressure = (float) bmp.readPressure();*
* pression = (float) pressure/100;*
* temp = (float) bmp.readTemperature();*
* hic = (float) dht.computeHeatIndex(t, h, false);*
_ while(t<=(rose*[0]))
{
i–;
}
Serial.print(pvap);
Serial.print(" % -");
tr1 = (float) rose[0];
tr2 = (float) rose[i+1][0];
pr1 = (float) rose[1];
pr2 = (float) rose[i+1][1];
ind1 = (float) tr2-tr1;
ind2 = (float) pr2-pr1;
ind3 = (float) t-tr1;
ind7 = (float) ind2/ind1;
ind8 = (float) ind3ind7;
* pr3 = (float) pr1+ind8;
pvap = (float) pr3h/100;_
* i=56;*
_ while(pvap<=rose*[1])
{
i–;
}
tr3 = (float) rose[0];
tr4 = (float) rose[i+1][0];
pr4 = (float) rose[1];
pr5 = (float) rose[i+1][1];
ind4 = (float) tr2-tr1;
ind5 = (float) pr5-pr4;
ind6 = (float) pvap-pr4;
trose = (float) tr3+ind5ind6/ind4;
* Serial.print (t);
Serial.print (" - “);
Serial.println (h);
Serial.print (tr1);
//Serial.print (” - “);
//Serial.print (tr2);
//Serial.print (” - “);
//Serial.print (pr1);
//Serial.print (” - “);
//Serial.print (pr2);
//Serial.print (” - “);
//Serial.print (pr3);
//Serial.print (” - “);
// Serial.print (ind1);
//Serial.print (” - “);
//Serial.print (ind2);
//Serial.print (” - “);
//Serial.print (ind3);
//Serial.println (” - ");*_
* //Serial.print (tr3);*
* //Serial.print (" - ");*
* //Serial.print (tr4);*
* //Serial.print (" - ");*
* //Serial.print (pr4);*
* //Serial.print (" - ");*
* //Serial.print (pr5);*
* //Serial.print (" - ");*
* //Serial.print (ind4);*
* //Serial.print (" - ");*
* //Serial.print (ind5);*
* //Serial.print (" - ");*
* //Serial.print (ind6);*
* //Serial.print (" - ");*
* //Serial.println (trose);*
_ //Serial.print(rose*[0]);
//Serial.print(" C -");
//Serial.print(trose);
//Serial.print(" C -");
//Serial.print(pression);
//Serial.print(" hPa -");
//Serial.print(t);
//Serial.print(" C -");
//Serial.print(h);
//Serial.print(" HR -");
//Serial.print(temp);
//Serial.println(" C (bmp) -");*_
* data = “temp1=” + String(t) + “&hum1=” + String(h) + “&pression=” + String(pression) + “&indice=” + String(hic) + “&temprose=” + String(trose) + “&tempbmp=” + String(temp);*
* client.connect(“drouardphilippe.alwaysdata.net”,80);*
* client.println(“POST /add.php HTTP/1.1”);*
* client.println(“Host: drouardphilippe.alwaysdata.net”);*
* client.println(“Content-Type: application/x-www-form-urlencoded”);*
* client.print("Content-Length: ");*
* client.println(data.length());*
* client.println();*
* client.print(data);*
* client.stop(); // DISCONNECT FROM THE SERVER*
* delay(300000); // WAIT FIVE MINUTES BEFORE SENDING AGAIN*
}