temperature sensor question

hi everyone
i use two temperature sensor and i try to if the room0's temperature > 30. The led will light.
But it didn't.
this is my code

#include <OneWire.h>
#include <DallasTemperature.h>
int ledPin = 13;

// 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);

DeviceAddress room0 = { 0x28, 0xA0, 0x02, 0xB4, 0x04, 0x00, 0x00, 0xC0 };
DeviceAddress room1 = { 0x28, 0x08, 0x43, 0xB4, 0x04, 0x00, 0x00, 0x19 };

int i;

void setup(void)
{
// start serial port
Serial.begin(9600);
// Start up the library
sensors.begin();
// set the resolution to 10 bit
sensors.setResolution(room0, 10);
sensors.setResolution(room1, 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();
for(i = 0; i<2; i++){
Serial.print("room");
Serial.print(i);
Serial.print(": ");
Serial.println(sensors.getTempCByIndex(i));
}
float room0 = sensors.getTempCByIndex(0);
if(room0>30.00)
{
digitalWrite(ledPin,HIGH);
delay(1000);
return;
}
}

how can i modify
please help me :cold_sweat:

You are setting up the device addresses at the start and then getting the temperature by index in the loop. This may not be the cause of your problem but it is surely pointless, and certainly muddies the water.

Since you already have the addresses, you might check out Mark McComb's stuff at Hacktronics.