// This project implements the simulation of the reading a DHT sensor using an ESP32
// The source code is available on my git repo at : https://github.com/Bamamou/DHT11_ESP32.git
// the only difference is the sensor, Here; we use a DHT11 while in Platform io we use a DHT22
#include <DHT.h>
#include <HX711.h>
const int ld_cell = 2;
const int ld_sck = 4;
HX711 scale;
// Set up the DHT sensor
DHT dht(5, DHT22);
float temperature ;
float humidity;
int counter;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial.println("Hello, ESP32!");
scale.begin(ld_cell, ld_sck);
scale.set_scale();
}
void loop() {
// put your main code here, to run repeatedly:
temperature = dht.readTemperature();
humidity = dht.readHumidity();
Serial.println("Data: "+ String(counter));
// Print the values of temperature in Celsus
Serial.print("Temperatue:\t");
Serial.print(dht.readTemperature(false));
Serial.println("C");
// print Humidity in perscent
Serial.println("Humidity: \t"+String(humidity)+ "%");
// Print the values of the heat Index for both Units
Serial.print("Heat Index In Celsus: ");
Serial.println(dht.computeHeatIndex(temperature, humidity, false));
Serial.println(scale.get_units()/420, 1);
delay(8000); // this speeds up the simulation
counter++;
}