Sensor
#struct SensorA DHT sensor on a pin, with its kind (DHT11 or DHT22).
| Name | Type | Description |
|---|---|---|
pin | int = 0 | The pin the data wire is connected to. |
kind | int = 22 | DHT11 or DHT22. It decides the length of the start signal and how the five data bytes are read. |
import hw.board
import hw.dht
func main:
println dht.DHT11, dht.DHT22
board.SimDht(4, dht.DHT22, 480, 215)
room := dht.Open(4, dht.DHT22)
println dht.ReadTemperature(room), dht.ReadHumidity(room)
end11 22 21.5 48