Using a DHT11 Sensor and Liquid Crystal Display for Arduino Uno

Hi,

I'm using the DHT11 temperature and humidity sensor with an LCD for Arduino Uno. I have code for the LCD to display temperature, but how do I program it to display text if the temperature is over a certain degrees.

For example, once the temperature sensed is above 37 degrees Celsius, I want the LCD to display "At Risk".

How would I program that?

Thanks

with certain assumptions about names of objects etc. :

lcd.clear() ;
if ( temperatureReading > 37 ) {
   lcd.setCursor( 0, 0 ) ;
   lcd.print("at risk") ;
}

but post the code you have already created for a more useful answer.

Thanks. This is my current code:

#include <LiquidCrystal.h>

#include <SimpleDHT.h>



int pinDHT11 = 6;
SimpleDHT11 dht11;



const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

void setup() {

  
  Serial.begin(9600);
 

  
  lcd.begin(16, 2);
   
   
}

void loop() {


  
  
  Serial.println("=================================");
  Serial.println("DHT11 readings...");
  
 
  byte temperature = 0;


  
  Serial.print("Readings: ");
  Serial.print((int)temperature); Serial.print(" Celcius, ");
 
 

  lcd.clear();
 

  lcd.setCursor(0,0);


  lcd.print((int)temperature);
 
 
  
  
  
  delay(750);
}

Since you do not appear to read the temperature sensor, you see the digit zero on the lcd screen. Is that right ?

What do you mean by " not appear to read the temperature sensor"? I just tested the code and there's nothing on the LCD. It's blank and not even lit up.

How are you even reading the temperature right now? Isn’t there some sort of command for a DHT11 object which allows you to read temp and humidity? (I think it’s dht11.read) Right now, it should be displaying zero, right?

As per your question about the displaying “At Risk” on your LCD, just use an if statement.

I just tested the code and there's nothing on the LCD. It's blank and not even lit up.

You need to back up one step and get the LCD display running with the basic tutorial and library example for the lcd display.

https://www.arduino.cc/en/Tutorial/HelloWorld