#include #include // Data wire is connected to GPIO15 #define ONE_WIRE_BUS 15 // Setup a oneWire instance to communicate with a OneWire device OneWire oneWire(ONE_WIRE_BUS); // Pass our oneWire reference to Dallas Temperature sensor DallasTemperature sensors(&oneWire); DeviceAddress sensor1 = { 0x28, 0xFF, 0x70, 0xC5, 0x90, 0x17, 0x5, 0x8 }; DeviceAddress sensor2 = { 0x28, 0xFF, 0xEE, 0xC3, 0x90, 0x17, 0x5, 0x14 }; DeviceAddress sensor3 = { 0x28, 0xFF, 0x5E, 0x7B, 0x90, 0x17, 0x5, 0xD6 }; DeviceAddress sensor4 = { 0x28, 0xFF, 0xA1, 0xB1, 0x90, 0x17, 0x5, 0x3D }; /* ROM = 28 FF 70 C5 90 17 5 8 ROM = 28 FF EE C3 90 17 5 14 ROM = 28 FF 5E 7B 90 17 5 D6 ROM = 28 FF A1 B1 90 17 5 3D*/ void setup(void){ Serial.begin(115200); sensors.begin(); } void loop(void){ Serial.print("Requesting temperatures..."); sensors.requestTemperatures(); // Send the command to get temperatures Serial.println("DONE"); Serial.print("Sensor 1(*C): "); Serial.print(sensors.getTempC(sensor1)); Serial.print(" Sensor 1(*F): "); Serial.println(sensors.getTempF(sensor1)); Serial.print("Sensor 2(*C): "); Serial.print(sensors.getTempC(sensor2)); Serial.print(" Sensor 2(*F): "); Serial.println(sensors.getTempF(sensor2)); Serial.print("Sensor 3(*C): "); Serial.print(sensors.getTempC(sensor3)); Serial.print(" Sensor 3(*F): "); Serial.println(sensors.getTempF(sensor3)); Serial.print("Sensor 4(*C): "); Serial.print(sensors.getTempC(sensor4)); Serial.print(" Sensor 4(*F): "); Serial.println(sensors.getTempF(sensor4)); delay(2000); }