delay 10s

Dependencies:   HX711 DHT DS1820

Files at this revision

API Documentation at this revision

Comitter:
nextzero
Date:
Sun Nov 22 17:43:42 2020 +0000
Parent:
3:91c06faa6963
Child:
5:df7af32714c0
Commit message:
bruh;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sun Nov 22 17:33:57 2020 +0000
+++ b/main.cpp	Sun Nov 22 17:43:42 2020 +0000
@@ -8,7 +8,8 @@
 
 DS1820      ds1820_1(D3);  // substitute D8 with the actual pin name connected to the DS1820 sensor
 DS1820      ds1820_2(D6);
-float       temp = 0;
+float       temp1 = 0;
+float       temp2 = 0;
 int         result = 0;
 
 DHT sensor1(DHT_DATA_PIN, DHT22);                    //DHT(PinName pin, eType DHTtype)
@@ -43,22 +44,25 @@
         ds1820_2.startConversion();   // start temperature conversion from analog to digital
         ThisThread::sleep_for(1000);// let DS1820 complete the temperature conversion
         
-        result1 = ds1820_1.read(temp); // read temperature from DS1820 and perform cyclic redundancy check (CRC)
-        result2 = ds1820_2.read(temp); // read temperature from DS1820 and perform cyclic redundancy check (CRC)
+        result = ds1820_1.read(temp1); // read temperature from DS1820 and perform cyclic redundancy check (CRC)
+        result = ds1820_2.read(temp1);
         
         error1 = sensor1.readData();                  //read error value
         error2 = sensor2.readData();                  //read error value
             
-        c1   = sensor1.ReadTemperature(CELCIUS);
-        h1   = sensor1.ReadHumidity();
-        c2   = sensor2.ReadTemperature(CELCIUS);
-        h2   = sensor2.ReadHumidity();
+        c_int   = sensor1.ReadTemperature(CELCIUS);
+        h_int   = sensor1.ReadHumidity();
+       
+        c_ext   = sensor2.ReadTemperature(CELCIUS);
+        h_ext   = sensor2.ReadHumidity();
         
-        pc.printf("temperature = %4.2f\r\n", c);  // on affiche les valeurs sur teraTerm pour debug
-        pc.printf("Humidite = %4.2f\r\n", h);
+        c_moyenne_int =(c_int + temp1 + temp2)/3;
+        
+        // pc.printf("temperature = %4.2f\r\n", c);  // on affiche les valeurs sur teraTerm pour debug
+        //pc.printf("Humidite = %4.2f\r\n", h);
         
         
-        device.printf("AT$SF=%02X%02X%02X%02X\r\n", (char) c,(char) h, (char) temp, (char) poids);  // on envoie les données sur l'antenne
+        device.printf("AT$SF=%02X%02X%02X%02X\r\n", (char) c_moyenne_int,(char) h_int, (char) c_ext, (char) h_ext,(char) balance);  // on envoie les données sur l'antenne
         wait(10.0f);
     }
 }