DHT-sensor-library/html/class_d_h_t.html
2019-07-04 17:03:06 +00:00

413 lines
19 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>DHT sensor library: DHT Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">DHT sensor library
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_d_h_t-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">DHT Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>Class that stores state and functions for <a class="el" href="class_d_h_t.html" title="Class that stores state and functions for DHT. ">DHT</a>.
<a href="class_d_h_t.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="_d_h_t_8h_source.html">DHT.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:afa429167bfeba848ab824fee0043f79d"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_d_h_t.html#afa429167bfeba848ab824fee0043f79d">DHT</a> (uint8_t pin, uint8_t type, uint8_t count=6)</td></tr>
<tr class="memdesc:afa429167bfeba848ab824fee0043f79d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Instantiates a new <a class="el" href="class_d_h_t.html" title="Class that stores state and functions for DHT. ">DHT</a> class. <a href="#afa429167bfeba848ab824fee0043f79d">More...</a><br /></td></tr>
<tr class="separator:afa429167bfeba848ab824fee0043f79d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5fea0c753872b62f0ea423b03b6a0ac0"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_d_h_t.html#a5fea0c753872b62f0ea423b03b6a0ac0">begin</a> (uint8_t usec=55)</td></tr>
<tr class="memdesc:a5fea0c753872b62f0ea423b03b6a0ac0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Setup sensor pins and set pull timings. <a href="#a5fea0c753872b62f0ea423b03b6a0ac0">More...</a><br /></td></tr>
<tr class="separator:a5fea0c753872b62f0ea423b03b6a0ac0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a68be09105aa7d831bb473c9d774918cf"><td class="memItemLeft" align="right" valign="top">float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_d_h_t.html#a68be09105aa7d831bb473c9d774918cf">readTemperature</a> (bool S=false, bool force=false)</td></tr>
<tr class="memdesc:a68be09105aa7d831bb473c9d774918cf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read temperature. <a href="#a68be09105aa7d831bb473c9d774918cf">More...</a><br /></td></tr>
<tr class="separator:a68be09105aa7d831bb473c9d774918cf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a582df4d39cd56b4acbd47fbe75aedcc3"><td class="memItemLeft" align="right" valign="top">float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_d_h_t.html#a582df4d39cd56b4acbd47fbe75aedcc3">convertCtoF</a> (float)</td></tr>
<tr class="memdesc:a582df4d39cd56b4acbd47fbe75aedcc3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Converts Celcius to Fahrenheit. <a href="#a582df4d39cd56b4acbd47fbe75aedcc3">More...</a><br /></td></tr>
<tr class="separator:a582df4d39cd56b4acbd47fbe75aedcc3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a90530e38a2f47893e4767dda1d00d2a4"><td class="memItemLeft" align="right" valign="top">float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_d_h_t.html#a90530e38a2f47893e4767dda1d00d2a4">convertFtoC</a> (float)</td></tr>
<tr class="memdesc:a90530e38a2f47893e4767dda1d00d2a4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Converts Fahrenheit to Celcius. <a href="#a90530e38a2f47893e4767dda1d00d2a4">More...</a><br /></td></tr>
<tr class="separator:a90530e38a2f47893e4767dda1d00d2a4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a47724a419777972edf68cd5b8aa85569"><td class="memItemLeft" align="right" valign="top">float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_d_h_t.html#a47724a419777972edf68cd5b8aa85569">computeHeatIndex</a> (bool isFahrenheit=true)</td></tr>
<tr class="memdesc:a47724a419777972edf68cd5b8aa85569"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute Heat Index Simplified version that reads temp and humidity from sensor. <a href="#a47724a419777972edf68cd5b8aa85569">More...</a><br /></td></tr>
<tr class="separator:a47724a419777972edf68cd5b8aa85569"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0d23921017e3d827e49bfd136b40a6aa"><td class="memItemLeft" align="right" valign="top">float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_d_h_t.html#a0d23921017e3d827e49bfd136b40a6aa">computeHeatIndex</a> (float temperature, float percentHumidity, bool isFahrenheit=true)</td></tr>
<tr class="memdesc:a0d23921017e3d827e49bfd136b40a6aa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Compute Heat Index Using both Rothfusz and Steadman's equations (<a href="http://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml">http://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml</a>) <a href="#a0d23921017e3d827e49bfd136b40a6aa">More...</a><br /></td></tr>
<tr class="separator:a0d23921017e3d827e49bfd136b40a6aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5f8c84378abe4eeecf34f09e2cdf90a0"><td class="memItemLeft" align="right" valign="top">float&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_d_h_t.html#a5f8c84378abe4eeecf34f09e2cdf90a0">readHumidity</a> (bool force=false)</td></tr>
<tr class="memdesc:a5f8c84378abe4eeecf34f09e2cdf90a0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read Humidity. <a href="#a5f8c84378abe4eeecf34f09e2cdf90a0">More...</a><br /></td></tr>
<tr class="separator:a5f8c84378abe4eeecf34f09e2cdf90a0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4c1508f2997a5d03968b3afdeae70e03"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_d_h_t.html#a4c1508f2997a5d03968b3afdeae70e03">read</a> (bool force=false)</td></tr>
<tr class="memdesc:a4c1508f2997a5d03968b3afdeae70e03"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read value from sensor or return last one from less than two seconds. <a href="#a4c1508f2997a5d03968b3afdeae70e03">More...</a><br /></td></tr>
<tr class="separator:a4c1508f2997a5d03968b3afdeae70e03"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Class that stores state and functions for <a class="el" href="class_d_h_t.html" title="Class that stores state and functions for DHT. ">DHT</a>. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="afa429167bfeba848ab824fee0043f79d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afa429167bfeba848ab824fee0043f79d">&#9670;&nbsp;</a></span>DHT()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">DHT::DHT </td>
<td>(</td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>pin</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>type</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>count</em> = <code>6</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Instantiates a new <a class="el" href="class_d_h_t.html" title="Class that stores state and functions for DHT. ">DHT</a> class. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">pin</td><td>pin number that sensor is connected </td></tr>
<tr><td class="paramname">type</td><td>type of sensor </td></tr>
<tr><td class="paramname">count</td><td>number of sensors </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a5fea0c753872b62f0ea423b03b6a0ac0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5fea0c753872b62f0ea423b03b6a0ac0">&#9670;&nbsp;</a></span>begin()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void DHT::begin </td>
<td>(</td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>usec</em> = <code>55</code></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Setup sensor pins and set pull timings. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">usec</td><td>Optionally pass pull-up time (in microseconds) before <a class="el" href="class_d_h_t.html" title="Class that stores state and functions for DHT. ">DHT</a> reading starts. Default is 55 (see function declaration in <a class="el" href="_d_h_t_8h.html">DHT.h</a>). </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a68be09105aa7d831bb473c9d774918cf"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a68be09105aa7d831bb473c9d774918cf">&#9670;&nbsp;</a></span>readTemperature()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">float DHT::readTemperature </td>
<td>(</td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>S</em> = <code>false</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>force</em> = <code>false</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Read temperature. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">S</td><td>Scale. Boolean value:<ul>
<li>true = Fahrenheit</li>
<li>false = Celcius </li>
</ul>
</td></tr>
<tr><td class="paramname">force</td><td>true if in force mode </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Temperature value in selected scale </dd></dl>
</div>
</div>
<a id="a582df4d39cd56b4acbd47fbe75aedcc3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a582df4d39cd56b4acbd47fbe75aedcc3">&#9670;&nbsp;</a></span>convertCtoF()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">float DHT::convertCtoF </td>
<td>(</td>
<td class="paramtype">float&#160;</td>
<td class="paramname"><em>c</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Converts Celcius to Fahrenheit. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">c</td><td>value in Celcius </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>float value in Fahrenheit </dd></dl>
</div>
</div>
<a id="a90530e38a2f47893e4767dda1d00d2a4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a90530e38a2f47893e4767dda1d00d2a4">&#9670;&nbsp;</a></span>convertFtoC()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">float DHT::convertFtoC </td>
<td>(</td>
<td class="paramtype">float&#160;</td>
<td class="paramname"><em>f</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Converts Fahrenheit to Celcius. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">f</td><td>value in Fahrenheit </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>float value in Celcius </dd></dl>
</div>
</div>
<a id="a47724a419777972edf68cd5b8aa85569"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a47724a419777972edf68cd5b8aa85569">&#9670;&nbsp;</a></span>computeHeatIndex() <span class="overload">[1/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">float DHT::computeHeatIndex </td>
<td>(</td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>isFahrenheit</em> = <code>true</code></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Compute Heat Index Simplified version that reads temp and humidity from sensor. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">isFahrenheit</td><td>true if fahrenheit, false if celcius (default true) </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>float heat index </dd></dl>
</div>
</div>
<a id="a0d23921017e3d827e49bfd136b40a6aa"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0d23921017e3d827e49bfd136b40a6aa">&#9670;&nbsp;</a></span>computeHeatIndex() <span class="overload">[2/2]</span></h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">float DHT::computeHeatIndex </td>
<td>(</td>
<td class="paramtype">float&#160;</td>
<td class="paramname"><em>temperature</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">float&#160;</td>
<td class="paramname"><em>percentHumidity</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>isFahrenheit</em> = <code>true</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Compute Heat Index Using both Rothfusz and Steadman's equations (<a href="http://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml">http://www.wpc.ncep.noaa.gov/html/heatindex_equation.shtml</a>) </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">temperature</td><td>temperature in selected scale </td></tr>
<tr><td class="paramname">percentHumidity</td><td>humidity in percent </td></tr>
<tr><td class="paramname">isFahrenheit</td><td>true if fahrenheit, false if celcius </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>float heat index </dd></dl>
</div>
</div>
<a id="a5f8c84378abe4eeecf34f09e2cdf90a0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5f8c84378abe4eeecf34f09e2cdf90a0">&#9670;&nbsp;</a></span>readHumidity()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">float DHT::readHumidity </td>
<td>(</td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>force</em> = <code>false</code></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Read Humidity. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">force</td><td>force read mode </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>float value - humidity in percent </dd></dl>
</div>
</div>
<a id="a4c1508f2997a5d03968b3afdeae70e03"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4c1508f2997a5d03968b3afdeae70e03">&#9670;&nbsp;</a></span>read()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool DHT::read </td>
<td>(</td>
<td class="paramtype">bool&#160;</td>
<td class="paramname"><em>force</em> = <code>false</code></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Read value from sensor or return last one from less than two seconds. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">force</td><td>true if using force mode </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>float value </dd></dl>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li><a class="el" href="_d_h_t_8h_source.html">DHT.h</a></li>
<li><a class="el" href="_d_h_t_8cpp.html">DHT.cpp</a></li>
</ul>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.13
</small></address>
</body>
</html>