Thanks. Im only new to this so sorry about that. Any ideas of what im doing wrong.
There are compilation errors in your codes. I had to make a real setup on UNO and execute your codes. Please, compare the code that you have posted with the codes that I have posted below (after editing and executing your codes), you will be able to find the mistakes.
Please don't forget to connect a 2.2k resistor between Pin-2 of DS18B20 and 5V.
// First we include the libraries
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 8, 9, 10, 11, 12);
//int sensorVal1 = A1;
//int sensorVal2 = A1;
/********************************************************************/
// Data wire for temp in is plugged into pin 2 on the Arduino
#define ONE_WIRE_BUS 2
/********************************************************************/
// Setup a oneWire instance to communicate with any OneWire devices
// (not just Maxim/Dallas temperature ICs)
OneWire oneWire(ONE_WIRE_BUS);
/********************************************************************/
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
/********************************************************************/
void setup(void)
{
// start serial port
Serial.begin(9600);
Serial.println("Dallas Temperature IC Control Library Demo");
// Start up the library
sensors.begin();
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
lcd.clear();
lcd.print("OK!");
//Declare Inputs
// pinMode(sensorVal1, INPUT);
// pinMode(sensorVal2, INPUT);
}
void loop(void)
{
// Serial.println(" Requesting temperatures...");
sensors.requestTemperatures(); // Send the command to get temperature readings
// Serial.println("DONE");
//lcd.setCursor(0, 0); // Sets the cursor to col 0 and row 0
// lcd.print("Temp Inside: "); // Prints Sensor Val: to LCD
// lcd.print(analogRead(sensors.getTempCByIndex(0))); // Prints value on sensorVal1 to LCD
// lcd.setCursor(0, 1); // Sets the cursor to col 1 and row 0
// lcd.print("Temp Outside: "); // Prints Sensor Val: to LCD
// lcd.print(analogRead(sensors.getTempCByIndex(1))); // Prints value on sensorVal2 to LCD
{
Serial.print("Temperature out: ");
Serial.print(sensors.getTempCByIndex(0)); // Why "byIndex"?
// You can have more than one DS18B20 on the same bus.
// 0 refers to the first IC on the wire
//delay(2000);
Serial.print(" ");
Serial.print("Temperature in: ");
Serial.println(sensors.getTempCByIndex(1)); // Why "byIndex"?
// You can have more than one DS18B20 on the same bus.
// 1 refers to the second IC on the wire
// delay(2000);
}
{
lcd.setCursor(0, 0);
lcd.print("Temp Out: ");
lcd.print(sensors.getTempCByIndex(0));
lcd.setCursor(0, 1);
lcd.print("Temp In:: ");
lcd.print(sensors.getTempCByIndex(1));
}
delay(2000);
}