DHT22 Celsius to Fahrenheit Conversion help

Hi all. This is my first post. Im trying to change the temperature of my code from Celsius to Fahrenheit and I'm stuck. I'm taking a course in coding but I'm still very new so I will need the code and will need to know where to enter it in my sketch.
I'm using an Arduino Nano, DHT22 sensor and a 16x2 LCD with a 12c module.
It's working fine but the readout is in Celsius and In need to change it to Fahrenheit.
Thank you in advance.
Diana.

//Libraries
#include <DHT.h>
#include <Wire.h> 
#include <LCD.h>
#include <LiquidCrystal_I2C.h>

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

//ALWAYS USE THIS WITH LCD I2C and Addres 0x3F
#define I2C_ADDR 0x27
#define BACKLIGHT_PIN 3
#define En_pin 2
#define Rw_pin 1
#define Rs_pin 0
#define D4_pin 4
#define D5_pin 5
#define D6_pin 6
#define D7_pin 7
LiquidCrystal_I2C lcd(I2C_ADDR,En_pin,Rw_pin,Rs_pin,D4_pin,D5_pin,D6_pin,D7_pin);

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

void setup()
{
  Serial.begin(9600);
  dht.begin();
  lcd.begin(16,2);
  lcd.setBacklightPin(BACKLIGHT_PIN,POSITIVE);
  lcd.setBacklight(HIGH);
}

void loop()
{
  
  delay(2000);
  //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(hum);
  Serial.print(" %, Temp: ");
  Serial.print(temp);
  Serial.println(" Celsius");

  lcd.clear();
  lcd.setCursor(0,0);
  lcd.print("Temp: ");
  lcd.print(temp);
  lcd.print(" ");
  lcd.print((char)223);
  lcd.print("F");
  lcd.setCursor(0,1);
  lcd.print("Hum:  ");
  lcd.print(hum);
  lcd.print(" %");

  delay(5000); //Delay 5 sec.

}

The usual way - multiply by 9.0/5.0, and add 32.

AWOL:
The usual way - multiply by 9.0/5.0, and add 32.

Thank you for the reply but as I stated in my original post I'm very new to coding and I would need the code and also where to enter it in my sketch. I've tried many different formulas that I found online and I always come up with errors. Probably because I'm entering it in the wrong place.
Diana

Why don't you show us the code, and the errors, otherwise it looks like we're doing your assignment for you.

Your 'temp' variable is degrees in celsius.

You could to make another variable to store the result once you calculate the fahrenheit with the formula mentioned above. Makes more sense than calling up the conversion formula for every instance you want to print it.

temp*1.8+32

This should help, but you need to play around with where you think it should go and how you would make a new variable (mind your data type) for fahrenheit. Hopefully you figure it out and learn instead of asking for us to straight out give you the answer. The point of you taking the course is to learn, after all.

1 Like

INTP:
Hopefully you figure it out and learn instead of asking for us to straight out give you the answer. The point of you taking the course is to learn, after all.

As I stated I just started a coding class. have tried many ways to convert the temperature. All I'm asking is for the code and where it goes. Otherwise I'm running blind.
Dont you all recall when you all first started?
I came here for some simple help and I get looked down upon by professionals because I'm new to coding....
I'm sorry.
Diana

Dont you all recall when you all first started?

Yes.

I came here for some simple help and I get looked down upon by professionals because I'm new to coding....

No. You are being looked down on for failing to SHOW YOUR CODE.

PaulS:
Yes.
No. You are being looked down on for failing to SHOW YOUR CODE.

My code is in the first post of this thread.

Diana_74:
My code is in the first post of this thread.

See reply #1

AWOL:
See reply #1

I dont know how or where to put it.
This isnt an assignment either. The first class assignment was to program LED's to flash at different intervals.
This project is for myself.

Are you saying the course hasn't covered basic arithmetic?
You don't even need to do any assignments.

Have you looked at any of the programming examples provided in the IDE?

AWOL:
Are you saying the course hasn't covered basic arithmetic?
You don't even need to do any assignments.

Have you looked at any of the programming examples provided in the IDE?

I've looked at many examples but I don't know if I need to declare or edit something or where to put it in my code.
Every time I try to add it I get a different error

Post the non-working code you've tried and the associated error messages. There's a lot to be learned from the errors displayed.

Diana_74:
I've looked at many examples but I don't know if I need to declare or edit something or where to put it in my code.
Every time I try to add it I get a different error

see reply #3

We're not "looking down", we're trying to give a boost up.
Very few learned by not making mistakes - it's very easy to give a trivial solution to keep a noob quiet, but a noob who doesn't learn is going to remain a noob.