ok ok i see code tags -
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 7
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress sensor1 = { 0x28, 0x94, 0xE2, 0xDF, 0x02, 0x00, 0x00, 0xFE }; // when ready input correct address using this using tutorial :http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html
#define goalPin A5
int goalTemp = 0; //desired temp to be displayed on LCD
int goalVal = 0; //initial analog reading of pin A5
#include <LiquidCrystal.h>
LiquidCrystal lcd(4, 6, 10, 11, 12, 13); // initialize the library with the numbers of the interface pins
char textLine1[]="ActualT-"; //the string to print on the LCD
char textLine2[]="DesiredT-"; //the string to print on the LCD
long dsInterval = 1000; // **one second between updating sensor reading display - easier to view
long previousMillis = 0;
long goalInterval = 3; //3ms between A5 readings gathered
long previousGoalMillis = 0;
const int relayPin = 3; //the "s" of relay module attach to, output to relay
void setup()
{
pinMode(A5, INPUT);
pinMode(relayPin, OUTPUT); //initialize relay as an output
Serial.begin(9600); // initialize serial communication at 9600 bits per second
lcd.begin(16, 2); // set up the LCD's number of columns and rows
sensors.begin();
sensors.setResolution(sensor1, 10);
}
}
void loop()
{
float tempC = sensors.getTempC(deviceAddress);
sensors.requestTemperatures();
Serial.println(tempC);
unsigned long currentMillis = millis();
if(currentMillis - previousMillis > dsInterval) { //if enough time has passed
previousMillis = currentMillis;
lcd.setCursor(10,0);
lcd.print(sensorTemp); //print temp sensor reading on LCD
}
goalVal = analogRead(goalPin); // read the input on A5; sets required temp
goalTemp = (goalVal * 0.048828125); // conversion of data to C - 50/1024 = 0.048828125 - max temperature is 50C
unsigned long currentGoalMillis = millis();
if(currentGoalMillis - previousGoalMillis > goalInterval) { //if enough time has passed
previousGoalMillis = currentGoalMillis;
lcd.setCursor(11,1);
lcd.print(goalTemp); //update LCD with new reading for required temp
}
lcd.setCursor(0,0); // set the cursor to column 0, line 0 - Top line LHC
lcd.print(textLine1); // Print message 1 on the LCD
lcd.setCursor(15,0);
lcd.print("C");
lcd.setCursor(0,1);
lcd.print(textLine2); // Print message 2
lcd.setCursor(13,1);
lcd.print(".0C");
if (sensorTemp > goalTemp){
digitalWrite(relayPin,LOW); //heater off when temp high
} else {
digitalWrite(relayPin,HIGH); //keep heater on
}
}
and this is the example
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is plugged into pin 3 on the Arduino
#define ONE_WIRE_BUS 3
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature.
DallasTemperature sensors(&oneWire);
// Assign the addresses of your 1-Wire temp sensors.
// See the tutorial on how to obtain these addresses:
// http://www.hacktronics.com/Tutorials/arduino-1-wire-address-finder.html
DeviceAddress insideThermometer = { 0x28, 0x94, 0xE2, 0xDF, 0x02, 0x00, 0x00, 0xFE };
DeviceAddress outsideThermometer = { 0x28, 0x6B, 0xDF, 0xDF, 0x02, 0x00, 0x00, 0xC0 };
DeviceAddress dogHouseThermometer = { 0x28, 0x59, 0xBE, 0xDF, 0x02, 0x00, 0x00, 0x9F };
void setup(void)
{
// start serial port
Serial.begin(9600);
// Start up the library
sensors.begin();
// set the resolution to 10 bit (good enough?)
sensors.setResolution(insideThermometer, 10);
sensors.setResolution(outsideThermometer, 10);
sensors.setResolution(dogHouseThermometer, 10);
}
void printTemperature(DeviceAddress deviceAddress)
{
float tempC = sensors.getTempC(deviceAddress);
if (tempC == -127.00) {
Serial.print("Error getting temperature");
} else {
Serial.print("C: ");
Serial.print(tempC);
Serial.print(" F: ");
Serial.print(DallasTemperature::toFahrenheit(tempC));
}
}
void loop(void)
{
delay(2000);
Serial.print("Getting temperatures...\n\r");
sensors.requestTemperatures();
Serial.print("Inside temperature is: ");
printTemperature(insideThermometer);
Serial.print("\n\r");
Serial.print("Outside temperature is: ");
printTemperature(outsideThermometer);
Serial.print("\n\r");
Serial.print("Dog House temperature is: ");
printTemperature(dogHouseThermometer);
Serial.print("\n\r\n\r");
}
the error message is
fatal error: DallasTemperature.h: No such file or directory
compilation terminated.
Error compiling.