testing bugs

This commit is contained in:
Daniel Ledda
2020-10-31 15:24:33 +01:00
parent 0d618eff90
commit 4ed2d97de5

15
main.go
View File

@@ -63,13 +63,14 @@ func readDataFromDHT(pin *gpio.Pin) ([4]byte, error) {
time.Sleep(40 * time.Microsecond)
// Get Data
fmt.Println(pin.Read())
if cyclesForReading(pin, gpio.Low) == Timeout {
return receivedInput, errors.New(fmt.Sprintf(TimeoutErrInitial, "low"))
}
if cyclesForReading(pin, gpio.High) == Timeout {
return receivedInput, errors.New(fmt.Sprintf(TimeoutErrInitial, "high"))
}
time.Sleep(80 * time.Microsecond)
time.Sleep(80 * time.Microsecond)
//if cyclesForReading(pin, gpio.Low) == Timeout {
// return receivedInput, errors.New(fmt.Sprintf(TimeoutErrInitial, "low"))
//}
//if cyclesForReading(pin, gpio.High) == Timeout {
// return receivedInput, errors.New(fmt.Sprintf(TimeoutErrInitial, "high"))
//}
// Store cycle number for each low and high pulse
cycles := [80]int{}