// 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(15);
DallasTemperature sensor(&oneWire);

#include <WiFi.h>

void setup() {
  Serial.begin(9600);
  sensor.begin();
  delay(1000);
  Serial.print("Conectando-se ao Wi-Fi");
  WiFi.begin("Wokwi-GUEST", "", 6);
  while (WiFi.status() != WL_CONNECTED) {
    delay(100);
    Serial.print(".");
  }
  Serial.println(" Conectado!");
}

void loop() {
  delay(100); // TODO: Construa algo incrível!
  Serial.println(" Conectado!");
  sensor.requestTemperatures();
  Serial.print("Temperature is: ");
  delay(10);
  Serial.println(sensor.getTempCByIndex(0));
  delay(1000);
}