Library for the control of the DHT22.

Dependents:   Interfacage_Disco_DHT22

Revision:
1:3385bd532812
Parent:
0:a4f404326ee0
Child:
2:8c7fa818f329
--- a/DHT22.cpp	Wed Apr 15 18:45:36 2020 +0000
+++ b/DHT22.cpp	Thu Apr 16 08:55:38 2020 +0000
@@ -57,7 +57,6 @@
     // - Checksum
     bool packets[5][8];
     for (int i = 0; i < 5; i++) {
-        bool result[8];
         for (int j = 0; j < 8; j++) {
             // We wait the start of the bit with wait just in case we have been carrying error
             // wait_us(50);
@@ -68,16 +67,8 @@
             period.stop();
 
             // According to the documentation, it's 26us vs 70us
-            result[j] = period.read_us() > 60;
+            packets[i][j] = period.read_us() > 60;
         }
-        packets[i][0] = result[0];
-        packets[i][1] = result[1];
-        packets[i][2] = result[2];
-        packets[i][3] = result[3];
-        packets[i][4] = result[4];
-        packets[i][5] = result[5];
-        packets[i][6] = result[6];
-        packets[i][7] = result[7];
     }
 
     // Now we stop the sensor