#include "DHT.h"
#define DHTPIN A0 // Digital pin connected to the DHT sensor
#define DHTTYPE DHT22 // DHT 22 (AM2302), AM2321
// #define DHTTYPE DHT11 // DHT 11 (AM2302), AM2321
DHT dht(DHTPIN, DHTTYPE);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
dht.begin();
Serial.println("Máquina;Humedad;'Temp °C';'Temp °F';'Temp °K'");
}
void loop() {
// put your main code here, to run repeatedly:
float humedad = dht.readHumidity();
float tempCelcius = dht.readTemperature(); // celsius
float tempFahrenheith = dht.readTemperature(true); // fahrenheit
float tempKelvin = tempCelcius * 273.15; // temp Celsius en Kelvin
Serial.print("'Máquina 1';");
Serial.print(humedad); Serial.print("%;");
Serial.print(tempCelcius);Serial.print(";");
Serial.print(tempFahrenheith);Serial.print(";");
Serial.print(tempKelvin);Serial.println(";");
delay(3000);
}