Добавлен пример использования
This commit is contained in:
parent
09835137a5
commit
18c8adf305
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,2 +1,3 @@
|
||||
go.sum
|
||||
example
|
||||
./example
|
||||
!./cmd/*
|
||||
|
16
cmd/example/example.go
Normal file
16
cmd/example/example.go
Normal file
@ -0,0 +1,16 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"gitfox.ru/victor/go-dht"
|
||||
"gitfox.ru/victor/go-wiringpi"
|
||||
)
|
||||
|
||||
func main() {
|
||||
if temp, hum, err := dht.ReadDHT(wiringpi.GPIO_7); err != nil {
|
||||
fmt.Println(err)
|
||||
} else {
|
||||
ftemp := dht.CelsiumToFahrenheit(temp)
|
||||
fmt.Printf("Temperature (C): %.1f\nTemperature (F): %.1f\nHumidity: %.1f\n", temp, ftemp, hum)
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user