webduino.module.Dht
The Dht Class.
DHT is sensor for measuring temperature and humidity.
Table of Contents
Constructor
webduino.module.Dht
-
board
-
pin
Parameters:
-
board
webduino.BoardThe board that the DHT is attached to.
-
pin
IntegerThe pin that the DHT is connected to.
Methods
addListener
-
type
-
listener
Add a listener for a certain type of event.
Parameters:
-
type
StringEvent type.
-
listener
FunctionEvent listener.
emit
-
type
-
object,...
Emit an event of certain type.
Parameters:
-
type
StringEvent type.
-
[object,...]
Object optionalEvent object(s).
listeners
-
type
Return the listener list bound to certain type of event.
Parameters:
-
type
StringEvnet type.
on
-
type
-
listener
Alias for EventEmitter.addListener(type, listener)
Parameters:
-
type
StringEvent type.
-
listener
FunctionEvent listener.
once
-
type
-
listener
Add a one-time listener for a certain type of event.
Parameters:
-
type
StringEvent type.
-
listener
FunctionEvent listener.
read
-
callback
-
interval
Start reading data from sensor.
Parameters:
-
[callback]
Function optionalreading callback.
-
data
Objectreturned 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.
-
-
interval
Integerreading interval.
removeAllListeners
-
type
Remove all listeners of certain type.
Parameters:
-
type
StringEvent type.
removeListener
-
type
-
listener
Remove a listener for certain type of event.
Parameters:
-
type
StringEvent type.
-
listener
FunctionEvent listener.
setMaxListeners
-
n
Set maximum number of listeners that is allow to bind on an emitter.
Parameters:
-
n
NumberNumber 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.