Difference between revisions of "Component: Temp / Humidity (DHT22) (Environmental)"

From Flowcode Help
Jump to navigationJump to search
Line 20: Line 20:
  
 
==Detailed description==
 
==Detailed description==
 +
 +
  
  
Line 36: Line 38:
  
 
==Examples==
 
==Examples==
 +
 +
  
  
Line 53: Line 57:
 
{{Fcfile|DHT22_Example.fcfx|DHT22 Example}}
 
{{Fcfile|DHT22_Example.fcfx|DHT22 Example}}
  
==Downloadable macro reference==
+
==Macro reference==
  
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"
 
{| class="wikitable" style="width:60%; background-color:#FFFFFF;"

Revision as of 14:10, 20 January 2023

Author Matrix TSL
Version 1.2
Category Environmental


Temp / Humidity (DHT22) component

The DHT22 temperature and humidity sensor is a popular sensor allowing the ambient temperature and relative humidity to be monitored digitally. Humidity Range = 0% - 100% +/- 2% Temperature Range = -40 - 80 Degrees C +/- 0.5 Degrees C

Component Source Code

Please click here for the component source code: FC_Comp_Source_DHT22.fcfx

Detailed description

No detailed description exists yet for this component

Examples

Example Program showing how to sample the DHT22 sensor and show the temperature and humidity on an LCD. FC6 Icon.png DHT22 Example

Macro reference

Fc9-comp-macro.png GetTempWhole
Gets the whole number portion of the temperature returned by calling SampleSensor. If temperature is 15.8 degrees C then this function would return 15. 
Fc9-s16-icon.png - INT Return


Fc9-comp-macro.png GetHumidityFloat
Gets the humidity returned by calling SampleSensor as a floating point number. If humidity is 15.8 % then this function would return 15.8. 
Fc9-f32-icon.png - FLOAT Return


Fc9-comp-macro.png GetTempString
Gets the temperature returned by calling SampleSensor as a string. If temperature is 15.8 degrees C then this function would return "15.8". 
Fc9-string-icon.png - STRING Return


Fc9-comp-macro.png GetHumidityString
Gets the humidity returned by calling SampleSensor as a string. If humidity is 15.8 % then this function would return "15.8". 
Fc9-string-icon.png - STRING Return


Fc9-comp-macro.png GetHumidityWhole
Gets the whole number portion of the humidity returned by calling SampleSensor. If humidity is 15.8 % then this function would return 15. 
Fc9-s16-icon.png - INT Return


Fc9-comp-macro.png GetTempReal
Gets the real number portion of the temperature returned by calling SampleSensor. If temperature is 15.8 degrees C then this function would return 8. 
Fc9-s16-icon.png - INT Return


Fc9-comp-macro.png GetHumidityReal
Gets the real number portion of the humidity returned by calling SampleSensor. If humidity is 15.8 % then this function would return 8. 
Fc9-s16-icon.png - INT Return


Fc9-comp-macro.png SampleSensor
Communicates with the DHT22 sensor and receives the temperature and humidity readings. Returns 0 for success, 1 for no communication detected and 2 for checksum error. 
Fc9-u8-icon.png - BYTE Return


Fc9-comp-macro.png GetTempFloat
Gets the temperature returned by calling SampleSensor as a floating point number. If temperature is 15.8 degrees C then this function would return 15.8. 
Fc9-f32-icon.png - FLOAT Return



Property reference

Fc9-prop-icon.png Properties
Fc9-type-5-icon.png SIG Pin
Microcontroller I/O Pin connected to the DHT11 sensor data pin. 
Fc9-type-7-icon.png Use Checksum
The checksum value is used to ensure the data being received is correct. Yes = Only receive data if checksum is correct No = Ignore checksum 
Fc9-conn-icon.png Advanced Settings
Fc9-type-16-icon.png Clock Adjustment
On 8-bit PIC devices the timings can be a little tight as slower clock speeds and so we implement an adjustment factor to allow the sensor to function. Auto mode will attempt to automatically calculate a correct adjustment factor. Manual mode will allow you to set your own adjustment factor.