programming different sensors

The following procedures will satisfy the Step-1 of your requirements of Post-9. Please, follow the comments put against the code lines to undersyand the programming art.

1. Build the following setup using one Temperature Sensor and two LEDs.

ds18b20-4
Figure-1:

2. Upload the following sketch (tested in UNO):

#include <OneWire.h>
#include <DallasTemperature.h>

OneWire oneWire(2); //Sensor signal pin is connected with DPin-2
DallasTemperature sensors(&oneWire);// Pass our oneWire reference to Dallas Temperature.

void setup(void)
{
  Serial.begin(9600); // start serial port
  sensors.begin();    // Start up the library
  pinMode(5, OUTPUT);
  pinMode(13, OUTPUT);
}

void loop()
{
  sensors.requestTemperatures(); // Send the command to get temperatures
  Serial.print("Temperature from Sensor-1: ");
  float myTemp = sensors.getTempCByIndex(0);
  Serial.print(myTemp, 2);
  Serial.println("  *C");
  //----------------------------------------
  if (myTemp >= 30.00)  //test temperature
  {
    digitalWrite(5, HIGH);   //LED2 is turned on
    delay(10 * 60 * 1000UL); //10*60*1000 ms = 10 minute; UL = unsigned long = 2^32
    digitalWrite(5, LOW);  //LED2 is turned off
    delay(1*60*1000UL);  //1 minute
    //----------------------
    digitalWrite(13, HIGH);   //L is turned on
    delay(3*60*1000UL);       //3 minutes
    digitalWrite(13, LOW);   //L is turned off
  }
}

3. Check that LED2 and L behaves according to the escription of the sketch of Step-2.

4. Connect Sensor-2 in pararllel with Sensor-1 of Fig-1.
5. Add necessary codes with sketch of Step-2 to handle Sensor-2.