Nick_Pyner:
I thought you were using the same code as me, but apparently not.
I don't think your code should be much more complicated than this
You need to make sure all the characters are over- written when a new value is displayed./*
/*
// Copyright (c) 2010 Mark McComb, hacktronics LLC
// License: http://www.opensource.org/licenses/mit-license.php (Go crazy)
// Tutorial:
// Arduino 1-Wire Tutorial
// code uses Arduino LCD stuff, for shield on Freetronics EtherTen.
Use your own DS18B20 addresses, keys etc.
*/
#include <OneWire.h>
#include <DallasTemperature.h>
#include <LiquidCrystal.h>
LiquidCrystal lcd(8,9,A2,5,6,7);
byte InThermo[8] = {
0x28, 0x69, 0xC2, 0xB0, 0x03, 0x00, 0x00, 0X9F};
byte OutThermo[8] = {
0x28, 0x7A, 0x8B, 0xC0, 0x03, 0x00, 0x00, 0x2F};
#define ONE_WIRE_BUS 3 //pin 3
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float InTemp, OutTemp, tempC;
float diff;
void setup() {
lcd.begin(16, 2);
lcd.setCursor (0,0);
delay(2000);
sensors.begin();
sensors.setResolution(InThermo, 12);
sensors.setResolution(OutThermo, 12);
}
void loop() {
//get the values from the DS8B20's
sensors.requestTemperatures();
InTemp = (sensorValue(InThermo));
OutTemp = (sensorValue(OutThermo));
diff = OutTemp - InTemp;
lcd.setCursor (0,0);
lcd.print(InTemp);
lcd.setCursor (0,1);
lcd.print (OutTemp);
lcd.setCursor (8,1);
lcd.print(diff);
delay(1000);
} // loop ends here
//sensorValue function
float sensorValue (byte deviceAddress[])
{
tempC = sensors.getTempC (deviceAddress);
return tempC;
}
byte bcdToDec(byte val) {
// Convert binary coded decimal to normal decimal numbers
return ( (val/16*10) + (val%16) );
}
Ok, I will give this a go tonight.
I know my code is a mish mash and although the code below has been working since last night without error, I would like to better understand and improve it before moving on.