sensor v0.1.4 Sensor.Temp.Dht

Get temperature values using the DHT family of sensors. Please see the Sensor.Temp.Dht.Device module’s documentation to see how to install the necessary drivers for your Raspberry Pi or Pi2.

It can be initialize with three parameters, ( DhtType, pin, name ) where name is an atom

The sensor will be polled at 5 second intervals. Calling the read function will return the last reading, without waiting for a new read. This is because the reading process is somewhat slow, especially if the sensor returns an error, in which case, it will pause and then try again.

Summary

Functions

Spawned by the init function in a seperate process, it will request a new reading every 5 seconds. Please note that the reading process my run for many seconds if there are read failures, so the set function is NOT guaranteed to run every 5 seconds

Returns the most recent valid reading

Will update the state with a new reading. Normally only called by the poll_temp function

Will set the temperature value - only used during tests

Starts the DHT temp sensor server. type is to identify which type of DHT ( 11 | 22 ) gpio is the gpio number the sensor is attached to ( ex: 4 )

Functions

poll_temp(client, type, gpio)

Spawned by the init function in a seperate process, it will request a new reading every 5 seconds. Please note that the reading process my run for many seconds if there are read failures, so the set function is NOT guaranteed to run every 5 seconds.

read(name)
read(:atom) :: Sensor.Temp.t

Returns the most recent valid reading

set(name, reading)

Will update the state with a new reading. Normally only called by the poll_temp function

set_temp(name, temp)

Will set the temperature value - only used during tests.

start_link(type, gpio, name)
start_link(Integer, Integer, :atom) :: {atom, pid}

Starts the DHT temp sensor server. type is to identify which type of DHT ( 11 | 22 ) gpio is the gpio number the sensor is attached to ( ex: 4 )