DS18B20 temperature sensor caused 16x2 LCD display to corrupt.

I’m new to this and this is the first time i;ve tried to write my own code. I copped a few examples from the internet and followed the guides on how to wire them up and every thing works fine. Now I’ve moved onto writing something myself based on the examples I’ve tried and somethings gone very wrong.

Basically I’ve got a 1602A LCD keypad shield connected directly to my Arduino mega. I then connected the DS18B20 temperature sensor to 5v, grd, and pin 3, but it displays the text correctly from the 1st part of code in the void setup() section but then, when i ask it to print anything in the void loop() bit is just fills the display with rubbish? I’ve tried disconnecting the sensor in case i’d connected in wrong, it made no difference. Then I tried removing some of the code and I’ve found the 3 lines that case the display to start printing gobbledegook are :
sensors.requestTemperatures();
tempC = sensors.getTempCByIndex(0);
tempF = sensors.toFahrenheit(tempC);

the code i’m running is

#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 5
#include <LiquidCrystal.h>

//LCD pin to Arduino
const int pin_RS = 8;
const int pin_EN = 9;
const int pin_d4 = 4;
const int pin_d5 = 5;
const int pin_d6 = 6;
const int pin_d7 = 7;
const int pin_BL = 10;

LiquidCrystal lcd( pin_RS, pin_EN, pin_d4, pin_d5, pin_d6, pin_d7);

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

float tempC = 0;
float tempF = 0;

void setup() {
sensors.begin();
lcd.begin(16,2);
lcd.clear();
pinMode(3, OUTPUT);
analogWrite(3, 0);
Serial.begin(9600);

}

void loop() {
sensors.requestTemperatures();
tempC = sensors.getTempCByIndex(0);
tempF = sensors.toFahrenheit(tempC);
delay(1000);

Serial.println(tempC);
lcd.setCursor(0,0);
lcd.print(“C: “);
lcd.print(tempC);
lcd.print(” degrees”);
lcd.setCursor(0,1);
lcd.print(“F: “);
lcd.print(tempF);
lcd.print(” degrees”);
}

Why would these lines cause problems with the display? It’s bound to be something simple as i’m working blind on this and way out of my depth but still having fun learning new things although finding it frustrating at times. Any help much appreciated.

(deleted)

#define ONE_WIRE_BUS 5
...
//LCD pin to Arduino
const int pin_RS = 8;
const int pin_EN = 9;
const int pin_d4 = 4;
const int pin_d5 = 5;

You have a conflict on pin 5.

I knew the bottom lines were to do with the LCD connection pins but the top one #define ONE_WIRE_BUS 5 wasn't as clear for a newbie. Thanks for the help, now on the bigger and better things. I'm sure i'll be back with more questions in the future.