need help

This program that wrote works fine if I wanted degrees in Celsius, but I want Fahrenheit. Can anyone help figure this out . I would appreciate it very much.
Lou

Lou_s__project_for_humidity_and_temperature.ino (1.21 KB)

Do you really not know how to convert Celsius to Fahrenheit or how to find out ?

I have used Google and still does not help.
Lou

Hi,
Google equation for Celsius to Fahrenheit

https://www.mathsisfun.com/temperature-conversion.html

read these and put equation into your sketch.

Tom.... :slight_smile:

degF = ( degC * 9 / 5) + 32

Hi,

nathancamp:
degF = ( degC * 9 / 5) + 32

Do it in float, 9.0 and 5.0 and 32.0 float degF float degC
Tom.... :slight_smile:

I appreciate the post ,but where do you put it in the code. Thank you
Lou

I think you misunderstand the purpose of this Forum. Read the two intro posts at the top of this Forum by Nick Gammon. If you need a contract programmer to solve your problem, there are people here who will do that. However, most of us here help those who demonstrate they have tried to write the program themselves but can't get past some error in their code. Until we see that you have made that effort, there probably won't be much help coming from here.

I understand everything that you are saying. I have been coding not that long. I am just trying to figure out what is going on . I wrote this code my self with some help from Google. I am sorry if I have done something wrong.
Lou

Look at what I have tried:

#include <LiquidCrystal.h>
#include "DHT.h"

#define DHTPIN 13
#define DHTTYPE DHT11
#define Fahrenheit
#define F

DHT dht (DHTPIN, DHTTYPE);
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {
  Serial.begin(9600);
  Serial.println("Readng Sensor");
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  lcd.setCursor(0, 0);
  lcd. print("Readind Sensor");
  lcd.setCursor(0, 2);
  lcd.print("please wait...");
  delay(2000);
  lcd.clear();
  dht.begin();
}

void loop() {
  delay(2000);
  float h = dht.readHumidity();
  float t = dht.readTemperature();
  float f = dht.readTemperature(true);
  //Convert DegC to Deg F
  float degF = (t * 9.0 / 5.0) + 32.0;
  if (isnan(h) || isnan(t) || isnan(f)) {


    Serial.println("Failed to read DHT sersor!");
    return;

  }
  float low = dht.computeHeatIndex(f, h); {



    lcd.setCursor(0, 0);
    lcd.print("Temp.:");
    lcd.print(t);
    lcd.print(" C ");
    lcd.setCursor(0, 2);
    lcd.print("Humidity: ");
    lcd.print(h);
    lcd.print(" %\t");
    lcd.print(" F=");
    // Print the temperature in deg F
    lcd.print(degF);

    Serial.print("Humidity");
    Serial.print(h);
    Serial.print(" %\t");
    Serial.print("Temperature: ");
    Serial.print(t);
    Serial.print(" *F ");
    Serial.print("Temperature (oF): ");
    // Print the temperature in deg F
    Serial.print(degF);
  }

}

I thank you Nathan's
I appreciate it very much that you would take time to do this for me.
Lou