Serial printf removed in other to use the nRF52 without BLE Serial
Fork of DHT22 by
Revision 3:78e428144d16, committed 2017-11-03
- Comitter:
- DuyLionTran
- Date:
- Fri Nov 03 06:16:40 2017 +0000
- Parent:
- 2:340957cc8fef
- Commit message:
- serial print removed in other to use nRF52
Changed in this revision
DHT22.cpp | Show annotated file Show diff for this revision Revisions of this file |
DHT22.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 340957cc8fef -r 78e428144d16 DHT22.cpp --- a/DHT22.cpp Sat Jul 09 02:18:38 2011 +0000 +++ b/DHT22.cpp Fri Nov 03 06:16:40 2017 +0000 @@ -31,9 +31,6 @@ // This should be 40, but the sensor is adding an extra bit at the start #define DHT22_DATA_BIT_COUNT 41 - // debug -Serial pc(USBTX, USBRX); // Tx, Rx Using USB Virtual Serial Port - // Read Data From /etc/ttyACM* (linux port) DHT22::DHT22(PinName Data) { @@ -63,14 +60,12 @@ } if (int(currentTime - _lastReadTime) < 2) { - pc.printf("DHT22 Error Too Quick, wiat..."); return DHT_ERROR_TOOQUICK; } retryCount = 0; // Pin needs to start HIGH, wait unit it is HIGH with a timeout do { if (retryCount > 125) { - pc.printf("DHT22 Bus busy! "); return DHT_BUS_HUNG; } retryCount ++; @@ -91,7 +86,6 @@ retryCount = 0; do { if (retryCount > 40) {// (Spec is 80 us, 40*2 == 80us - pc.printf("DHT22 is not present! "); return DHT_ERROR_NOT_PRESENT; } retryCount ++; @@ -102,7 +96,6 @@ retryCount = 0; do { if (retryCount > 40) {// (Spec is 80 us, 40 * 2 == 100us) - pc.printf("DHT22 error timeout for receiveing last ack signal! "); return DHT_ERROR_ACK_TOO_LONG; } retryCount++; @@ -120,7 +113,6 @@ retryCount = 0; do { // Getting start bit signal if (retryCount > 25) { // spec is 50 u, 25*2 = 50 us - pc.printf("DHT22 sync timeout error! "); return DHT_ERROR_SYNC_TIMEOUT; } retryCount ++; @@ -130,7 +122,6 @@ retryCount = 0; do { if (retryCount > 40) { // spec is 80us, 50*2 == 100us - pc.printf("DHT22 ERROR DATA TIMEOUT\n"); return DHT_ERROR_DATA_TIMEOUT; } retryCount++; @@ -152,7 +143,6 @@ // First 16 bit is Humidity for (i=0; i<16; i++) { if (bitTimes[i] > 14) { - pc.printf("%d: bit time is %d us. ", i, bitTimes[i]); currentHumidity |= ( 1 << (15-i)); } } @@ -188,13 +178,9 @@ csPart3 = currentTemperature >> 8; csPart4 = currentTemperature & 0xFF; if (checkSum == ((csPart1 + csPart2 + csPart3 + csPart4) & 0xFF)) { - pc.printf("Calculate check sum is %d.",(csPart1 + csPart2 + csPart3 + csPart4) & 0xFF); - pc.printf("Reading check sum is %d.",checkSum); _lastReadTime = currentTime; - pc.printf("OK-->Temperature:%d, Humidity:%d\n", _lastTemperature, _lastHumidity); return DHT_ERROR_NONE; } - pc.printf("DHT22 Checksum error!"); return DHT_ERROR_CHECKSUM; }
diff -r 340957cc8fef -r 78e428144d16 DHT22.h --- a/DHT22.h Sat Jul 09 02:18:38 2011 +0000 +++ b/DHT22.h Fri Nov 03 06:16:40 2017 +0000 @@ -24,7 +24,6 @@ #define MBED_DHT22_H #include "mbed.h" -#include "NokiaLCD.h" /** * Currently supports DHT22 (SparkFun Electronics)