Component: Temp Humidity (DHT11 ) (Sensors)

From Flowcode Help
Jump to navigationJump to search


Author Matrix TSL
Version 1.1 (Release)
Category Sensors


Image Temp Humidity (DHT11 ) component

The DHT11 temperature and humidity sensor is a popular sensor allowing the ambient temperature and relative humidty to be monitored digitally. Humidity Range = 20% - 90% +/- 5% Temperature Range = 0 - 50 Degrees C +/- 2 Degrees C

Examples

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

Downloadable macro reference

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.

Parameters

This macro has no parameters


Return value

INT


GetHumidityFloat

Gets the humidity returned by calling SampleSensor as a floating point number.

Parameters

This macro has no parameters


Return value

FLOAT


GetHumidityString

Gets the humidity returned by calling SampleSensor as a string.

Parameters

This macro has no parameters


Return value

STRING


GetTempString

Gets the temperature returned by calling SampleSensor as a string.

Parameters

This macro has no parameters


Return value

STRING


GetHumidityWhole

Gets the whole number portion of the humidity returned by calling SampleSensor.

If humidity is 15.8 % then this function would return 15.

Parameters

This macro has no parameters


Return value

INT


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.

Parameters

This macro has no parameters


Return value

INT


GetHumidityReal

Gets the real number portion of the humidity returned by calling SampleSensor.

If humidity is 15.8 % then this function would return 8.

Parameters

This macro has no parameters


Return value

INT


SampleSensor

Communicates with the DHT11 sensor and receives the temperature and humidity

readings.

Returns 0 for success, 1 for no communication detected and 2 for checksum error.

Parameters

This macro has no parameters


Return value

BYTE


GetTempFloat

Gets the temperature returned by calling SampleSensor as a floating point number.

Parameters

This macro has no parameters


Return value

FLOAT


Simulation macro reference

This component does not contain any simulation macros


Property reference

Data Pin

This property is of type Single digital pin and can be referenced with the variable name dpin.

Microcontroller I/O Pin connected to the DHT11 sensor data pin.

Use Checksum

This property is of type True or false and can be referenced with the variable name csum.

The checksum value is used to ensure the data being received is correct.

Yes = Only receive data if checksum is correct

No = Ignore checksum