diff --git a/examples/dht11.toit b/examples/dht11.toit index bec3f61..39cd50b 100644 --- a/examples/dht11.toit +++ b/examples/dht11.toit @@ -5,7 +5,7 @@ import dhtxx import gpio -GPIO_PIN_NUM ::= 14 +GPIO_PIN_NUM ::= 14 main: pin := gpio.Pin GPIO_PIN_NUM diff --git a/examples/dht22.toit b/examples/dht22.toit index 0648ce5..0718fe0 100644 --- a/examples/dht22.toit +++ b/examples/dht22.toit @@ -5,7 +5,7 @@ import dhtxx import gpio -GPIO_PIN_NUM ::= 14 +GPIO_PIN_NUM ::= 14 main: pin := gpio.Pin GPIO_PIN_NUM diff --git a/src/driver_.toit b/src/driver_.toit index b1d16d1..40f1dd1 100644 --- a/src/driver_.toit +++ b/src/driver_.toit @@ -111,6 +111,10 @@ abstract class Driver: channel_in_.start_reading channel_out_.write start_signal response := channel_in_.read + if response.size == 2 and (response.period 0) == 0 and (response.period 1) == 0: + // We are getting some spurious signals from the start signal, + // which we just ignore. + response = channel_in_.read channel_in_.stop_reading // We expect to see: