import BlynkLib as blynklib
import dht
import time
# Set the Blynk Auth Token
blynk_auth_token = "YOUR_BLYNK_AUTH_TOKEN"
# Initialize the Blynk connection
blynk = blynklib.Blynk(blynk_auth_token)
# Initialize the DHT22 sensor
sensor = dht.DHT22(Pin(4))
# Create a Blynk temperature gauge widget
temp_gauge = blynk.widget.Gauge(name="Temperature", value=0, units="°C")
while True:
# Measure the temperature
sensor.measure()
temp = sensor.temperature()
# Update the Blynk temperature gauge widget
temp_gauge.update(temp)
# Send the temperature data to Blynk
blynk.run()
# Wait for 1 second
time.sleep(1)