I've been working with this guy for a couple hours now and haven't had any luck...
It is a DS18B20 waterproof temp sensor that I got off ebay. I have a 5 pack, so I've cycled through them with no difference, so I hope the whole batch isn't bad.
Below is the latest code I have tried. I'm not sure where else to go...
/* Basic 2xDS18B20 code for serial monitor, bluetooth, Excel or w.h.y.
Derived from Hacktronics. USE THEIR ADDRESS SNIFFER and substitute your
numbers. Use Hacktronics connections diagram.
http://www.hacktronics.com/Tutorials/arduino-1-wire-tutorial.html
Stay away from using parasite power
-127C means bad connection
85 means you haven't gotten a read yet, probably just the
wrong order of commands
*/
#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);
byte Thermo1[8] = {0x28, 0x39, 0xFD, 0x50, 0x04, 0x00, 0x00, 0X69};
byte Thermo2[8] = {0x28, 0x09, 0xA9, 0xC0, 0x03, 0x00, 0x00, 0x95};
float tempC,Temp1,Temp2;
void setup(){
Serial.begin(9600);
sensors.begin();
delay(500);//Wait for newly restarted system to stabilize
sensors.setResolution(Thermo1, 12);
sensors.setResolution(Thermo2, 12);
}
void loop() {
sensors.requestTemperatures(); // call readings from the addresses
Temp1 = sensorValue(Thermo1);
Temp2 = sensorValue(Thermo2);
Serial.print(" Temp1 = ");
Serial.print(Temp1);
Serial.print(" Temp2 = ");
Serial.println(Temp2);
delay(1000);
}
//sensorValue function
float sensorValue (byte deviceAddress[])
{
tempC = sensors.getTempC (deviceAddress);
return tempC;
}