Skip to content

Commit 56fb346

Browse files
Elfo404deadprogram
authored andcommitted
dht: fix error check in example
1 parent 3d279d4 commit 56fb346

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

examples/dht/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func main() {
1212
dhtSensor := dht.New(pin, dht.DHT11)
1313
for {
1414
temp, hum, err := dhtSensor.Measurements()
15-
if err != nil {
15+
if err == nil {
1616
fmt.Printf("Temperature: %02d.%d°C, Humidity: %02d.%d%%\n", temp/10, temp%10, hum/10, hum%10)
1717
} else {
1818
fmt.Printf("Could not take measurements from the sensor: %s\n", err.Error())

0 commit comments

Comments
 (0)