Troubleshoot for disp. temp and soil moisture

I recently began this project, all my sensors work on their own however when I try to combine them in order to display on an LCD screen the temp sensor stops working, any help would be great.

/*

  • Takes in temperature
  • Display temperature on LCD
  • Read soil moisture every second
  • If soil moisture is less than __ turn on water pump
    */

#include <LiquidCrystal.h>
#include <dht_nonblocking.h>
#define DHT_SENSOR_TYPE DHT_TYPE_11

//reading values
int soilMoisture = 0;
int temperature = 0;
bool pumpOnOff = false;

//soil
int soilPin = A0;
int soilPower = 1;

//temperature
static const int DHT_SENSOR_PIN = 7;
DHT_nonblocking dht_sensor( DHT_SENSOR_PIN, DHT_SENSOR_TYPE );

//lcd
LiquidCrystal lcd(12,11,5,4,3,2);

void setup() {
Serial.begin(9600);
lcd.begin(16,2);//initializes lcd
lcd.print(“Turning on soil”);
lcd.setCursor(0,1);
lcd.print(“and temp sensor”);
pinMode(soilPower, OUTPUT);//Set D1 as an OUTPUT
digitalWrite(soilPower,LOW);//Set to LOW so no power is flowing through the sensor
delay(5000); //delay code for 5 seconds
lcd.clear();
}
static bool measure_environment( float *temperature, float *humidity )
{
static unsigned long measurement_timestamp = millis( );

/* Measure once every four seconds. */
if( millis( ) - measurement_timestamp > 3000ul )
{
if( dht_sensor.measure( temperature, humidity ) == true )
{
Serial.print(“test”);
measurement_timestamp = millis( );
return( true );
}
}

return( false );
}
void loop() {
lcd.setCursor(0,0); //set beginning of string to the first column, first row
SoilMoisture1();
temperature1();

}
void SoilMoisture1() {

lcd.print("SoilMoist: "); //output soil moisture
lcd.print(readSoilMoisture());
lcd.setCursor(0,1);
lcd.print("Temp: “); //output temperature
lcd.print(temperature + " C”);

Serial.print("Soil Moisture = "); //get soil moisture value from the function below and print it
Serial.println(readSoilMoisture());

if(readSoilMoisture() < 20){
pumpOnOff = true;
}else{
pumpOnOff = false;
}

if(pumpOnOff){

}
}

int readSoilMoisture(){
digitalWrite(soilPower, HIGH);
delay(1000);
soilMoisture = analogRead(soilPin);
digitalWrite(soilPower, LOW);
return soilMoisture;
}

/*

  • Main program loop.
    */
    void temperature1()
    {
    float temperature;
    float humidity;

/* Measure temperature and humidity. If the functions returns
true, then a measurement is available. */
if( measure_environment( &temperature, &humidity ) == true )
{
Serial.print( "T = " );
Serial.print( temperature, 1 );
Serial.print( " deg. C, H = " );
Serial.print( humidity, 1 );
Serial.println( “%” );
//return temperature;
}
}

If you to actually debug the problem by using Serial.print(soilMoisture), what would you see?

Paul

Serial.begin(9600);
int soilPower = 1;

Serial uses pin 1. Change soilPower to something else.