from machine import Pin
import dht
import time
SensorPin=Pin(15)
Sensor=dht.DHT22(SensorPin)
ip="10.10.10.1"
print("===SENSOR SERVER===")
print(f"Listening on http://{ip}")
while True:
try:
Sensor.measure()
temp=Sensor.temperature()
humidity=Sensor.humidity()
print(f"""
Temepature: {temp}
Humidity: {humidity}
""")
except OSError:
print("Failed to read ")
time.sleep(2)