#include #include // Провод данных подключен к контакту 2 на Arduino #define ONE_WIRE_BUS 2 // Настройка oneWire для связи с любыми устройствами OneWire // (не только Maxim/Dallas температурные IC) OneWire oneWire(ONE_WIRE_BUS); DallasTemperature sensors(&oneWire); void setup(void) { // start serial port Serial.begin(9600); Serial.println("Dallas Temperature IC Control Library Demo"); // Start up the library sensors.begin(); } void loop(void) { // call sensors.requestTemperatures() to issue a global temperature // request to all devices on the bus Serial.print(" Requesting temperatures..."); sensors.requestTemperatures(); // Send the command to get temperatures Serial.println("DONE"); Serial.print("Temperature is: "); Serial.print(sensors.getTempCByIndex(0)); // Why "byIndex"? // You can have more than one IC on the same bus. // 0 refers to the first IC on the wire delay(1000); }