import time
# ==========================================
# 1. DICTIONARIES WITH SENSOR DATA
# ==========================================
# Each key represents the ESP32 identifier
# and its value is the sensor reading.
temp = {
"ESP1": 21.5,
"ESP2": None, # Simulates an error or device disconnection
"ESP3": 19.8
}
humid = {
"ESP1": 65,
"ESP2": 0, # Simulates a humidity reading failure
"ESP3": 58
}
weight = {
"ESP1": 1.2,
"ESP2": None, # Simulates missing weight reading
"ESP3": 1.5
}
# ==========================================
# 2. CONTINUOUS DATA PRINTING ON CONSOLE
# ==========================================
# Temperature Readings
print("--- Temperature Readings (°C) ---")
for device, value in temp.items():
print(f"Temperature at {device}: {value}°C")
time.sleep(2) # 2-second pause between each reading
# ==========================================
# 3. FINAL MESSAGE
# ==========================================
print("\nMonitoring completed.")
No hay comentarios:
Publicar un comentario