Serial printf removed in other to use the nRF52 without BLE Serial

Dependents:   BLE_Bike

Fork of DHT22 by HO WING KIT

Revision:
1:5b20ff4fd227
Parent:
0:547e68daeb1b
Child:
2:340957cc8fef
--- a/DHT22.cpp	Tue Jun 21 03:44:05 2011 +0000
+++ b/DHT22.cpp	Mon Jul 04 07:35:03 2011 +0000
@@ -36,13 +36,16 @@
 
 #include "DHT22.h"
 
+
 // This should be 40, but the sensor is adding an extra bit at the start
 #define DHT22_DATA_BIT_COUNT 41
 
+Serial pc(USBTX, USBRX);   // Tx, Rx Using USB Virtual Serial Port
+                           // Read Data From /etc/ttyACM* (linux port)
+
 DHT22::DHT22(PinName Data) {
     _data = Data;                // Set Data Pin
-    DigitalInOut      VCC(_vcc);
-    _lastReadTime = time(NULL)-2;
+    _lastReadTime = time(NULL);
     _lastHumidity = 0;
     _lastTemperature = DHT22_ERROR_VALUE;
 }
@@ -52,23 +55,23 @@
 
 DHT22_ERROR DHT22::readData() {
     int i, retryCount;
-    int currentTemperature;
-    int currentHumidity;
-    unsigned int checkSum, csPart1, csPart2, csPart3, csPart4;
+    int currentTemperature=0;
+    int currentHumidity=0;
+    unsigned int checkSum = 0, csPart1, csPart2, csPart3, csPart4;
     unsigned int bitTimes[DHT22_DATA_BIT_COUNT];
-    time_t currentTime;
+    time_t currentTime = time(NULL);
 
     DigitalInOut  DATA(_data);
 
-    currentHumidity = 0;
-    currentTemperature = 0;
-    checkSum = 0;
-    currentTime = time(NULL);
+       
     for (i = 0; i < DHT22_DATA_BIT_COUNT; i++) {
         bitTimes[i] = 0;
     }
+    
     if (currentTime - _lastReadTime < 2) {
-        // Caller needs to wait 2 seconds between each call to read Data
+        // Caller needs to wait 2 seconds between each call to read Data        
+        pc.printf("Current Time: %s\n",currentTime);
+        pc.printf("Last Read Time: %s\n", _lastReadTime);
         return DHT_ERROR_TOOQUICK;
     }
     _lastReadTime = currentTime;