B4R Question DHT22sensor.Read22 not return 0 if failure

jcohedman

Member
Licensed User
Hellow!
When I'm reading DHT22 sensor with an ESP8266, if it is connected, gives the values, but if desconnected, don't return 0, continues with the last values measured...
What I'm doing wrong?

B4X:
DHT22pin1.Initialize(5,DHT22pin1.MODE_INPUT) 
DHT22sensor1.Read22(DHT22pin1.PinNumber)            'Reading the DHT22 measure
    hum1=NumberFormat (DHT22sensor1.GetHumidity,0,0)      'Get humidity from readed measure
    temp1 =NumberFormat (DHT22sensor1.GetTemperature,0,0)  'Get temperature from readed measure
 
Top