temperature sensor problem

i test the code and it had some wrong
if i remove pin3,the inside and outside temperature would display 0.0032
if i didn’t remove the pin3 ,the inside and outside temperature would display Error getting temperature
how to do solve the problem

this is code

#include <OneWire.h>
#include <DallasTemperature.h>
#include <NewSoftSerial.h>
NewSoftSerial xbee(2,3);

// 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:

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)
{
Serial.begin(9600);
xbee.begin(9600);
sensors.begin();
// set the resolution to 10 bit (good enough?)
sensors.setResolution(insideThermometer, 10);
sensors.setResolution(outsideThermometer, 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(DallasTemperature::toFahrenheit(tempC));
}
}

void loop(void)
{
delay(1000);
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”);
}

123.png

dapingQ:
#include <OneWire.h>
#include <DallasTemperature.h>
#include <NewSoftSerial.h>
NewSoftSerial xbee(2,3);

// Data wire is plugged into pin 3 on the Arduino
#define ONE_WIRE_BUS 3

Your essential sensor code seems to be the same as mine, probably came from Hacktronics, and appears to be kosher.

I don’t use Soft Serial but you appear to have the temp sensors on pin 3 and the Xbee on pin 2 and 3, ergo, a clash. Another possibility is that you are calling it but the wires are actually somewhere else, ergo, no clash but no action either.