Ds18b20 question

can someone tell me about how to program 2 sensor ds18b20?


See this library: https://github.com/milesburton/Arduino-Temperature-Control-Library

There is an example for multiples sensors :)

This is about as simple as you can get and is based on this tutorial. Use their address sniffer and substitute your numbers. Stay away from anything that does not use DallasTemperature.h .

/* 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. 
 Stay away from using parasite power
 -127C means bad connection
 85 means you haven't gotten a read yet, probably wrong order of commands
 Use your own LCD connections

#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(){
/*No resolution command means default to 12 bit
  sensors.setResolution(Thermo1, 10); 
  sensors.setResolution(Thermo2, 10);

  delay(1000);//Wait for newly restarted system to stabilize

void loop() {
  sensors.requestTemperatures();  // call readings from the addresses
  Temp1 = sensorValue(Thermo1);
  Temp2 = sensorValue(Thermo2);  

  Serial.print("      Temp1 = ");
  Serial.print("      Temp2 = "); 


//sensorValue function
float sensorValue (byte deviceAddress[])
  tempC = sensors.getTempC (deviceAddress);
  return tempC;

Or with more, using arrays : http://forum.arduino.cc/index.php?topic=393653.msg2711178#msg2711178