#include <OneWire.h> #include <DallasTemperature.h> int T1[8] = {0x28, 0x4C, 0x83, 0x3D, 0x00, 0x00, 0x00, 0x46}; int T2[8] = {0x28, 0xDB, 0xAC, 0x3C, 0x00, 0x00, 0x00, 0x6A}; float s1 = 0; float s2 = 0; OneWire oneWireBus12(12); DallasTemperature sensors12(&oneWireBus12); OneWire oneWireBus2(2); DallasTemperature sensors2(&oneWireBus2); void setup() { Serial.begin(9600); sensors12.begin(); sensors2.begin(); } void loop() { sensors12.requestTemperatures(); s1 = sensors12.getTempCByIndex(T1); sensors2.requestTemperatures(); s2 = sensors2.getTempCByIndex(T2); Serial.println((String("S1 - ") + String(s1) + String(" S2 - ") + String(s2))); delay(1000); }
Открыть пример: Online ArduBlock
Видеоурок: