g// After running the simulator, click on the DS18B20 chip to change the temperature
// Chip by bonnyr, source code: https://github.com/bonnyr/wokwi-ds1820-custom-chip/

#include <OneWire.h>
#include <DallasTemperature.h>

OneWire oneWire(10);
DallasTemperature sensor(&oneWire);

void setup(void) {
  Serial.begin(115200);
  delay(2);
  sensor.begin();
  delay(20);
}

void loop(void) {
  sensor.requestTemperatures();
  Serial.print("Temperature is: ");
  delay(10);
  Serial.println(sensor.getTempCByIndex(0));
  delay(1000);
}
Loading
ds18b20