#include #include OneWire ds(4); //D2 GPIO4 DS18B20 IN OUT DallasTemperature sensors(&ds); #define DS18B20_BIT 12 // 精度の設定bit byte temp0[8] = { 0x28, 0x48, 0x90, 0x7A, 0x12, 0x21, 0x01, 0x90 }; byte temp1[8] = { 0x28, 0x58, 0xA7, 0x57, 0x12, 0x21, 0x01, 0xF3 }; byte temp2[8] = { 0x28, 0xFF, 0x64, 0x02, 0x19, 0x2E, 0x3E, 0x39 }; // DeviceAddress void setup() { Serial.begin(115200); while (!Serial) { } sensors.setResolution(DS18B20_BIT); delay(1000); } void loop(void){ Serial.println("Temp Start"); sensors.requestTemperatures(); // 温度取得要求 delay(1000); Serial.println(sensors.getTempC(temp0)); Serial.println(sensors.getTempC(temp1)); Serial.println(sensors.getTempC(temp2)); delay(1000); }