ESP12-F, DHT22-code fails
Posted: Thu Mar 04, 2021 8:42 pm
Hello,
I've tested my new ESP12-F with the well known 'blink.py'; it works.
In the next step I have this code:
This code is running well on ESP32 and ESP8266/D1-mini.
It doesn't run on ESP12-F. I get only the message 'Failed to read sensor.'
Why That, what's wrong?
Best regards
I've tested my new ESP12-F with the well known 'blink.py'; it works.
In the next step I have this code:
Code: Select all
from machine import Pin
from time import sleep
import dht
sensor = dht.DHT22(Pin(14))
while True:
try:
sleep(5)
sensor.measure()
temp = sensor.temperature()
hum = sensor.humidity()
print('Temperature: %3.1f C' %temp)
print('Humidity: %3.1f %%' %hum)
except OSError as e:
print('Failed to read sensor.')
It doesn't run on ESP12-F. I get only the message 'Failed to read sensor.'
Why That, what's wrong?
Best regards