#include <Arduino.h>
#include <DHT.h>
const int DHTPIN = 15; // Pin where the sensor is connected
#define DHTTYPE DHT22 // Defining the sensor type as DHT22
DHT dht(DHTPIN, DHTTYPE);
void setup() {
Serial.begin(115200); // Opens the communication channel with the Serial Monitor
dht.begin(); // Initializes the sensor hardware
Serial.println("--- SIGNAL MONITORING SYSTEM INITIALIZED ---");
}
void loop() {
delay(1500); // Wait a moment for a stable reading interval
// Read the environmental variables from the sensor
float humidity = dht.readHumidity();
float temperature = dht.readTemperature();
// Print the results directly onto the Serial Monitor
Serial.print("Signal Received -> Humidity: ");
Serial.print(humidity, 1);
Serial.print("% | Temperature: ");
Serial.print(temperature, 1);
Serial.println("°C");
}
No hay comentarios:
Publicar un comentario