Combining a Temperature & Humidity Sensor code with a Soil Moisture Sensor code

Hey there!

I’m kindda new at writing codes but I managed to make working ones for a DHT22 and an RD-SOIL3 sensor separately. However, I would need them to give serials together at the same time so I would need to combine my codes but I am not sure how to do it. Can someone please help in it ?

Code for DHT22:

#include <DHT.h>;

#define DHTPIN 7     // what pin we're connected to
#define DHTTYPE DHT22   // DHT 22  (AM2302)
DHT dht(DHTPIN, DHTTYPE); //// Initialize DHT sensor for normal 16mhz Arduino

int chk;
float hum;  //Stores humidity value
float temp; //Stores temperature value

void setup()

void loop()
    //Read data and store it to variables hum and temp
    hum = dht.readHumidity();
    temp= dht.readTemperature();
    //Print temp and humidity values to serial monitor
    Serial.print("Humidity: ");
    Serial.print(" %, Temp: ");
    Serial.println(" Celsius");
    delay(1000); //Delay 2 sec.

Code for RD-SOIL3:

int sensorPin1 = A0; 
int sensorPin2 = A1;
float sensorValue1;
float sensorValue2;  
int limit = 340; 
int limit2 = 617;
int limit3 = 715;

void setup() {
 pinMode(13, OUTPUT);

void loop() {

 sensorValue2 = analogRead(sensorPin2);

 if (sensorValue2>0) {
 sensorValue2 = sensorValue2/limit3;
 sensorValue2 = sensorValue2*100;
 else {


What have you tried?

Post your best attempt, and tell us what didn’t go well.
Try to avoid giving variables larger scope that they need.

#include <DHT.h>;

No need for the semicolon with preprocessor directives

else {

Did you forget something?