#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>
// Data wire is plugged into pin 7 on the Arduino
#define ONE_WIRE_BUS 7
// 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 kettleThermometer = { 0x28, 0x94, 0xE2, 0xDF, 0x02, 0x00, 0x00, 0xFE };
DeviceAddress mashThermometer = { 0x28, 0x6B, 0xDF, 0xDF, 0x02, 0x00, 0x00, 0xC0 };
DeviceAddress HLTThermometer = { 0x28, 0x59, 0xBE, 0xDF, 0x02, 0x00, 0x00, 0x9F };
// Connections:
// rs (LCD pin 4) to Arduino pin 12
// rw (LCD pin 5) to Arduino pin 11
// enable (LCD pin 6) to Arduino pin 10
// LCD pin 15 to Arduino pin 13
// LCD pins d4, d5, d6, d7 to Arduino pins 5, 4, 3, 2
LiquidCrystal lcd(12, 11, 10, 5, 4, 3, 2);
int backLight = 13; // pin 13 will control the backlight
void setup(void)
{
pinMode(backLight, OUTPUT);
digitalWrite(backLight, HIGH); // turn backlight on. Replace 'HIGH' with 'LOW' to turn it off.
// start serial port
Serial.begin(9600);
// Start up the library
sensors.begin();
// set the resolution to 10 bit (good enough?)
sensors.setResolution(kettleThermometer, 10);
sensors.setResolution(mashThermometer, 10);
sensors.setResolution(HLTThermometer, 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)
{
lcd.begin(20,4); // columns, rows.
lcd.clear(); // start with a blank screen
delay(2000); // is the delay needed?
lcd.setCursor(0,0); // set cursor to column 0, row 0 (the first row)
lcd.print("Getting temperatures...\n\r"); // inform me that its doing something
sensors.requestTemperatures();
lcd.setCursor(0,1); // set cursor to column 0, row 1
lcd.print("Kettle temperature is: ");
printTemperature(insideThermometer);
lcd.print("\n\r");
lcd.setCursor(0,2); // set cursor to column 0, row 2
lcd.print("Mash temperature is: ");
printTemperature(outsideThermometer);
lcd.print("\n\r");
lcd.setCursor(0,3); // set cursor to column 0, row 3
lcd.print("HLT temperature is: ");
printTemperature(dogHouseThermometer);
lcd.print("\n\r\n\r");
}