#include <OneWire.h> #include <DallasTemperature.h> OneWire oneWire(4); DallasTemperature sensors(&oneWire); DeviceAddress temp; void setup(void) { Serial.begin(9600); sensors.begin(); sensors.getAddress(temp,0); } void loop(void) { for(int i=0;i<8;i++){ Serial.print(" 0x"); Serial.print(temp[i],HEX); } Serial.println(); sensors.requestTemperatures(); Serial.println(sensors.getTempC(temp)); delay(500); }
#include <OneWire.h> #include <DallasTemperature.h> OneWire oneWire(4); DallasTemperature sensors(&oneWire); DeviceAddress temp1 = {0x28,0xAA,0x60,0xE0,0x57,0x14,0x1,0x5D}; DeviceAddress temp2 = {0x28,0xAA,0x55,0xEF,0x57,0x14,0x1,0x91}; void setup(void) { Serial.begin(9600); sensors.begin(); } void loop(void) { sensors.requestTemperatures(); Serial.println(sensors.getTempC(temp1)); Serial.println(sensors.getTempC(temp2)); delay(500); }