91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 15KB
    文件類型: .zip
    金幣: 2
    下載: 1 次
    發布日期: 2021-06-18
  • 語言: 其他
  • 標簽: arduino??

資源簡介

dht11 庫文件 歡迎下載

資源截圖

代碼片段和文件信息

/*?DHT?library

MIT?license
written?by?Adafruit?Industries
*/

#include?“DHT.h“

#define?MIN_INTERVAL?2000
#define?TIMEOUT?-1

DHT::DHT(uint8_t?pin?uint8_t?type?uint8_t?count)?{
??_pin?=?pin;
??_type?=?type;
??#ifdef?__AVR
????_bit?=?digitalPinToBitMask(pin);
????_port?=?digitalPinToPort(pin);
??#endif
??_maxcycles?=?microsecondsToClockCycles(1000);??//?1?millisecond?timeout?for
?????????????????????????????????????????????????//?reading?pulses?from?DHT?sensor.
??//?Note?that?count?is?now?ignored?as?the?DHT?reading?algorithm?adjusts?itself
??//?based?on?the?speed?of?the?processor.
}

//?Optionally?pass?pull-up?time?(in?microseconds)?before?DHT?reading?starts.
//?Default?is?55?(see?function?declaration?in?DHT.h).
void?DHT::begin(uint8_t?usec)?{
??//?set?up?the?pins!
??pinMode(_pin?INPUT_PULLUP);
??//?Using?this?value?makes?sure?that?millis()?-?lastreadtime?will?be
??//?>=?MIN_INTERVAL?right?away.?Note?that?this?assignment?wraps?around
??//?but?so?will?the?subtraction.
??_lastreadtime?=?millis()?-?MIN_INTERVAL;
??DEBUG_PRINT(“DHT?max?clock?cycles:?“);?DEBUG_PRINTLN(_maxcycles?DEC);
??pullTime?=?usec;
}

//boolean?S?==?Scale.??True?==?Fahrenheit;?False?==?Celcius
float?DHT::readTemperature(bool?S?bool?force)?{
??float?f?=?NAN;

??if?(read(force))?{
????switch?(_type)?{
????case?DHT11:
??????f?=?data[2];
??????if?(data[3]?&?0x80)?{
????????f?=?-1?-?f?;
??????}
??????f?+=?(data[3]?&?0x0f)?*?0.1;
??????if(S)?{
????????f?=?convertCtoF(f);
??????}
??????break;
????case?DHT12:
??????f?=?data[2];
??????f?+=?(data[3]?&?0x0f)?*?0.1;
??????if?(data[2]?&?0x80)?{
????????f?*=?-1;
??????}
??????if(S)?{
????????f?=?convertCtoF(f);
??????}
??????break;
????case?DHT22:
????case?DHT21:
??????f?=?((word)(data[2]?&?0x7F))?<??????f?*=?0.1;
??????if?(data[2]?&?0x80)?{
????????f?*=?-1;
??????}
??????if(S)?{
????????f?=?convertCtoF(f);
??????}
??????break;
????}
??}
??return?f;
}

float?DHT::convertCtoF(float?c)?{
??return?c?*?1.8?+?32;
}

float?DHT::convertFtoC(float?f)?{
??return?(f?-?32)?*?0.55555;
}

float?DHT::readHumidity(bool?force)?{
??float?f?=?NAN;
??if?(read(force))?{
????switch?(_type)?{
????case?DHT11:
????case?DHT12:
??????f?=?data[0]?+?data[1]?*?0.1;
??????break;
????case?DHT22:
????case?DHT21:
??????f?=?((word)data[0])?<??????f?*=?0.1;
??????break;
????}
??}
??return?f;
}

//boolean?isFahrenheit:?True?==?Fahrenheit;?False?==?Celcius
float?DHT::computeHeatIndex(bool?isFahrenheit)?{
??float?hi?=?computeHeatIndex(readTemperature(isFahrenheit)?readHumidity()
????isFahrenheit);
??return?isFahrenheit???hi?:?convertFtoC(hi);
}

//boolean?isFahrenheit:?True?==?Fahrenheit;?False?==?Celcius
float?DHT::computeHeatIndex(float?temperature?float?percentHumidity
??bool?isFahrenheit)?{
??//?Using?both?Rothfusz?and?Steadman‘s?equations
??//?http://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml
??float?hi;

??if?(!isFahrenheit)
????temperature?=?convertCtoF(temperature);

??hi?=?0.5?*?(temperature?+?61.0?+?((temperature?-?68.0)?*

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2019-02-18?18:20??DHT-sensor-library-master\
?????目錄???????????0??2019-02-18?18:20??DHT-sensor-library-master\.github\
?????文件????????2624??2019-02-18?18:20??DHT-sensor-library-master\.github\ISSUE_TEMPLATE.md
?????文件????????1415??2019-02-18?18:20??DHT-sensor-library-master\.github\PULL_REQUEST_TEMPLATE.md
?????文件????????9749??2019-02-18?18:20??DHT-sensor-library-master\DHT.cpp
?????文件????????1804??2019-02-18?18:20??DHT-sensor-library-master\DHT.h
?????文件????????6196??2019-02-18?18:20??DHT-sensor-library-master\DHT_U.cpp
?????文件????????2297??2019-02-18?18:20??DHT-sensor-library-master\DHT_U.h
?????文件?????????942??2019-02-18?18:20??DHT-sensor-library-master\README.md
?????目錄???????????0??2019-02-18?18:20??DHT-sensor-library-master\examples\
?????目錄???????????0??2019-02-18?18:20??DHT-sensor-library-master\examples\DHT_Unified_Sensor\
?????文件????????3294??2019-02-18?18:20??DHT-sensor-library-master\examples\DHT_Unified_Sensor\DHT_Unified_Sensor.ino
?????目錄???????????0??2019-02-18?18:20??DHT-sensor-library-master\examples\DHTtester\
?????文件????????2539??2019-02-18?18:20??DHT-sensor-library-master\examples\DHTtester\DHTtester.ino
?????文件?????????529??2019-02-18?18:20??DHT-sensor-library-master\keywords.txt
?????文件?????????321??2019-02-18?18:20??DHT-sensor-library-master\library.properties

評論

共有 條評論