webduino.module.Dht
The Dht Class.
DHT is sensor for measuring temperature and humidity.
Table of Contents
Constructor
webduino.module.Dht
-
board -
pin
Parameters:
-
boardwebduino.BoardThe board that the DHT is attached to.
-
pinIntegerThe pin that the DHT is connected to.
Methods
addListener
-
type -
listener
Add a listener for a certain type of event.
Parameters:
-
typeStringEvent type.
-
listenerFunctionEvent listener.
emit
-
type -
object,...
Emit an event of certain type.
Parameters:
-
typeStringEvent type.
-
[object,...]Object optionalEvent object(s).
listeners
-
type
Return the listener list bound to certain type of event.
Parameters:
-
typeStringEvnet type.
on
-
type -
listener
Alias for EventEmitter.addListener(type, listener)
Parameters:
-
typeStringEvent type.
-
listenerFunctionEvent listener.
once
-
type -
listener
Add a one-time listener for a certain type of event.
Parameters:
-
typeStringEvent type.
-
listenerFunctionEvent listener.
read
-
callback -
interval
Start reading data from sensor.
Parameters:
-
[callback]Function optionalreading callback.
-
dataObjectreturned data from sensor, humidity and temperature will be passed into callback function as parameters.
callback()will be transformed to
callback({humidity: humidity, temperature: temperature})automatically.
-
-
intervalIntegerreading interval.
removeAllListeners
-
type
Remove all listeners of certain type.
Parameters:
-
typeStringEvent type.
removeListener
-
type -
listener
Remove a listener for certain type of event.
Parameters:
-
typeStringEvent type.
-
listenerFunctionEvent listener.
setMaxListeners
-
n
Set maximum number of listeners that is allow to bind on an emitter.
Parameters:
-
nNumberNumber of listeners.
stopRead
()
Stop reading value from sensor.
Attributes
Events
DhtEvent.READ
Fires when reading value.
DhtEvent.READ_ERROR
Fires when error occured while reading value.