Switch to use noInterrupts and interrupts function. make read() public. This resolves pull #15.

This commit is contained in:
Tony DiCola 2014-06-02 13:13:50 -07:00
parent ce05c3536c
commit 9611395a77
2 changed files with 3 additions and 3 deletions

View File

@ -119,7 +119,7 @@ boolean DHT::read(void) {
pinMode(_pin, OUTPUT); pinMode(_pin, OUTPUT);
digitalWrite(_pin, LOW); digitalWrite(_pin, LOW);
delay(20); delay(20);
cli(); noInterrupts();
digitalWrite(_pin, HIGH); digitalWrite(_pin, HIGH);
delayMicroseconds(40); delayMicroseconds(40);
pinMode(_pin, INPUT); pinMode(_pin, INPUT);
@ -149,7 +149,7 @@ boolean DHT::read(void) {
} }
sei(); interrupts();
/* /*
Serial.println(j, DEC); Serial.println(j, DEC);

2
DHT.h
View File

@ -24,7 +24,6 @@ class DHT {
private: private:
uint8_t data[6]; uint8_t data[6];
uint8_t _pin, _type, _count; uint8_t _pin, _type, _count;
boolean read(void);
unsigned long _lastreadtime; unsigned long _lastreadtime;
boolean firstreading; boolean firstreading;
@ -35,6 +34,7 @@ class DHT {
float convertCtoF(float); float convertCtoF(float);
float computeHeatIndex(float tempFahrenheit, float percentHumidity); float computeHeatIndex(float tempFahrenheit, float percentHumidity);
float readHumidity(void); float readHumidity(void);
boolean read(void);
}; };
#endif #endif